Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

HI, I am trying to send a simple notification using system.net.mail.mailmessage. I just pass the string as the message body. But problem is even though multi-line message been send have the correct " " format info in string. The mail opened in outlook will displayed as a long single line. But view source in outlook will display the message with correct new line format.

For example: original message would looks like:

line1
line 2
line 3

But it will displayed in Outlook like:

line1 line 2 line 3

View source from outlook will still display

line1
line 2
line 3

What should I do to make outlook display the message with correct newline information?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
415 views
Welcome To Ask or Share your Answers For Others

1 Answer

Outlook sometimes removes newlines (it usually pops up a comment that it has done it as well), not sure exactly about the rules for when it does this but I'm fairly sure if you add a . (full stop) at the end of each line it won't remove them.

Actually, looking at this article it seems like you can also solve it by sending the emails as HTML or RTF: Line breaks are removed in posts made in plain text format in Outlook


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...