• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 422
  • Last Modified:

Delphi and Outlook - adding line feeds to the body text

I've written a program that interacts with Outlook but I'm having trouble getting linefeeds into the body of the text.  The 2 pertinent lines of the program are:
mail:= 'mailto:'+gmail+'?subject=' +sub + '&body='+body+'&cc='+gmailcc;

and
ShellExecute(Handle,'open',PChar(mail),nil,nil,SW_SHOWNORMAL);

where :
gmail, gmailcc are addresses
sub is just some text
body is the message of the email

My question is how to put linefeeds in this message
0
s_w_e2
Asked:
s_w_e2
  • 2
1 Solution
 
epasquierCommented:
you can insert '%0A' in your body string where you want a line return

This will convert all 'normal' ret line codes with it
body:=StringReplace(body,#13#10,'%0A',[rfReplaceAll]);

Open in new window

0
 
bjoveCommented:
Use '%0D%0A' as newline string.

body := 'Line1'+'%0D%0A'+'Line2';

Open in new window

0
 
s_w_e2Author Commented:
Thank you
0
 
epasquierCommented:
Have I not said the same thing ???
Plus the way to automatically replace ascii ret line with the sequence in your entire body string ?
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now