I have an email with a table and one value contains a string with multiple lines. (enter-key) When viewed in outlook or view source in IE, the white-space is not working.
Any idea or any solution?
Thanks.
This is related to Outlook (not C#). I have the same problem (using Java to send mail). I am using CSS style white-space:pre-wrap;
on a span and it works well to preserve tabs, spaces, new lines and wrap text in GMail - web, Android and iOS.
As per my experimentation on Outlook 2016 Windows app and webapp (outlook.office365.com):
New lines within html are not rendered as such. You need to add <br>
tags at the end of each line to make sure that the email is rendered correctly with the new lines.
You can do this within your c# code by replacing every new line character in your problematic value with <br>
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.