delphi - How do I include line breaks in an e-mail message created with ShellExecute? -


i can send email shellexecute. address correct, sender address correct, , subject correct. body of email correct, except there no line breaks @ , appears a single paragraph no line breaks. default email client in case windows 8.1 mail.

my question is, can shellexecute used line breaks retained? not looking send email directly indy. need send email default email client , have formatted correctly.

procedure tform1.email1click(sender: tobject); var   igridtableitem: tcxcustomgridtableitem;   iname, idate, iemail, isubject, ibody, iparam: string; begin   igridtableitem := cxgrid1dbtableview1.datacontroller.     getitembyfieldname('email');   if igridtableitem.editvalue <> null   iemail := igridtableitem.editvalue;   igridtableitem := cxgrid1dbtableview1.datacontroller.     getitembyfieldname('name');   if igridtableitem.editvalue <> null   iname := igridtableitem.editvalue;   igridtableitem := cxgrid1dbtableview1.datacontroller.     getitembyfieldname('date');   if igridtableitem.editvalue <> null   idate := datetostr(igridtableitem.editvalue);   isubject := 'imageen ebook';   ibody := 'dear mr. ' + iname + ',' + slinebreak + slinebreak +     'paypal has advised me purchased xxxxx on ' + idate +     '.' + '  thank-you purchase.' + slinebreak + slinebreak + 'you may ' +     'download xxx at' + slinebreak +     'http://www.xxxxx.xxx/xxx/ebook/xxx101.zip' + slinebreak +     'best regards,' + slinebreak  + 'william miller' + slinebreak  +     'adirondack software , graphics ' + slinebreak  + 'email: xxx@xxxxxxxx.xxx'      iparam := 'mailto:' + iemail + '?subject=' + isubject + '&body=' + ibody;   shellexecute(form1.handle, 'open', pchar(iparam), nil, nil, sw_shownormal); end; 

different mail apps support mailto protocol differently. not apps allow multiple parameters specified together, etc. using mailto send emails going spotty on different machines.

that being said, invoking url, 1 mailto: protocol scheme. such, need url-encode reserved characters, spaces , line breaks. might not want use indy send mail, can use encode parameter values, @ least:

uses   ..., iduri;  iparam := 'mailto:' + iemail + '?subject=' + tiduri.paramsencode(isubject) + '&body=' + tiduri.paramsencode(ibody); 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -