Reputation: 11
I'm using Enviroment.NewLine property to separate lines of string of characters that I will send via email through an smtpclient. I will omit the part of declaring the mail message.
For example:
Dim sb as StringBuilder
sb.Append("This is my first line")
sb.Append(Enviroment.NewLine)
sb.Append("This is my second line")
When I do a:
myMailMessage.Body = sb.ToString
No lines are separated. I debugged and noticed that Enviroment.NewLine is returning " "
I don't understand why it is happening, it is supposed to return a break line.
Thanks a lot.
Upvotes: 0
Views: 74
Reputation: 717
Enviroment.NewLine
might show as empty string in the debugger (because there are no printable symbols). Enviroment.NewLine
is platform specific to the platform you are running your code on, not to the platform of email reader. I would just use "\r\n"
as it covers both, *nix and Windows. If your email is not plain-text, you can use <br/>
. Upvotes: 1
Reputation: 2783
Instead of Enviroment.NewLine
put <br/>
. And check the email in an email client.
Upvotes: 3