Send Email from String, line breaks are gone

Hi, I intend to send/reply to an email using Reply To Outlook Mail Message. This email will have a body which is a String which was nicely formatted with line breaks (vbCrLf). However when I send this email, all the line breaks are gone and I get a chunk of text without paragraphing and such. How do I include line breaks when sending an email using this activity?

@DEATHFISH Where is the mail body located, Is it stored in a variable? What activity or method have you used to send the mail ?

Mail body is stored as a String variable.

Previous email is a MailMessage variable

Activity used is Reply To Outlook Mail Message.

For some reason, all vbCrLf are gone and I get one big chunk of email text

@DEATHFISH Can you show the value of the Mail Body String? Just need to know how the vbCrLf have been implemented. You can try to use Environment.NewLine instead of vbCrLf and check if it works properly

Hi, here is the email string

"Hi " + SenderName + "," + Environment.NewLine + Environment.NewLine + _
"With regards To your email titled " + ReceivedSubject + ", dated " + _
SentDate.ToString("dd MMMM yyyy, HH:mm:ss") + ", our system was not able to process your request due to the following reasons: " _
+ Environment.NewLine + Environment.NewLine

The actual email is slightly longer but this works for example purposes. I used both vbCrLf and Environment.NewLine, when I receive the email these line breaks are gone.

Note that when I write the whole string to a text file, I see the line breaks as expected

@DEATHFISH Then can you do a Check by Writing the Mail Body in a Text File, after that read the Text file and then send the Output of Read text File as mail Body. This is weird, but if it works then we can conclude that The Body property won’t consider the New Lines

Hi, I tried this, writing the String to a text file, reading the text file, and then output this readout as mail body… It didn’t work, the .txt file had line breaks, the email had no line breaks.

@DEATHFISH You are using Send Outook Mail Message Activity right?

@DEATHFISH I think I found the solution you needed. Can you Check this video link :

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.