Text part from text file

Hello
Making a new MailMessage with plain text body part only, and importing the text body part from external text file:

MailMessage.Body = File.ReadAllText(TextFile, Encoding.UTF8)

Will work but line breaks are not applied correctly, the whole text is continuous without new lines, missing something?
Thanks :slight_smile:

Hello,

I have not been able to reproduce this.
I created a text file with the following contents:

new line
new line
new line
new line
new line
new line
new line
..

And then, executed the following code:

var eml = new MailMessage();
eml.Body = File.ReadAllText(@"text.txt", Encoding.UTF8);
eml.Save("text.eml");
1 Like

Hello
Thanks, what about if use it with this text:
Help.zip (4.6 KB)

Hello,
Thanks, we will check it and give you a feedback.

1 Like

or this:
Text.zip (259 Bytes)

Ok, thank you.

Hi @australian.dev.nerds

Unfortunately, we were unable to reproduce your issue. On our side everything works correctly. We noticed that in the first file you sent us, the end of the line is CR instead of CRLF, this may be the cause of this problem. In any case, to continue the investigation, we need additional information (a code snippet or a simple test project) - how you reproduce the problem and where you see the incorrect use of line breaks.Thanks.