I'm attempting to send emails from my C# app using the System.Net.Mail.MailMessage class. For the body of the email, I want to include line breaks to create separate blocks of text. How can I get an email client, like Outlook, to respect the line breaks when display the email has HTML to users? What character(s) do I insert in the body of the email text so that the line breaks are treated as line breaks?
Note: The body of my email is pure text, not HTML.
Line breaks are white space characters, and all white space characters are interpreted as spaces in HTML.
You can use break tags (<br/>
) to add line breaks in the HTML code, and you can use paragraph tags (<p>...</p>
) around paragraphs to get a distance between them.
You can just use Environment.NewLine property. That will insert a newline string defined for the current environment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With