C# – Send HTML email with line breaks

cemail

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.

Best Answer

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.