Shaimaa Fawzy
Shaimaa Fawzy

Reputation: 45

the email body removing all lines break (windows form )

i'm generating a simple email in windows form application using the

 System.Net.Mail.MailMessage 

and i can't add new line to email body , I've tried almost all possible things so far, like :

Environment.Newline

"\n" , "\t" , "\r\r"

 Regex.Replace(body, @"(?<!\t)((?<!\r)(?=\n)|(?=\r\n))", "\t", RegexOptions.Multiline);

Upvotes: 0

Views: 268

Answers (2)

Shaharyar
Shaharyar

Reputation: 12439

Email body is actually read as an HTML. So you should use HTML tags to accomplish your body design.

Use <br> tag for changing the line.

MailMessage.IsBodyHtml must be set to true to render it as an HTML email.

Upvotes: 3

junPac
junPac

Reputation: 111

The linked response below might help.

How to create a multi line body in C# System.Net.Mail.MailMessage

Upvotes: 0

Related Questions