I sent mail using SMTP (ASP.NET).
I wrote the text in only one line, but I want to be in the next line.
I used \n but it does not work.
\n
System.Environment.NewLine
If you format your email as HTML, you can add <br /> to it.
<br />
To format in HTML, use the IsBodyHtml property of the MailMessage class.
http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.isbodyhtml.aspx
if IsBodyHtml == false, then https://social.msdn.microsoft.com/Forums/vstudio/en-US/82da38ac-ac20-4c9a-a2bd-8512d88fdd41/c-newline-in-email?forum=csharpgeneral suggests:
Use% 0D% 0A to split lines.To simplify, use "\ r \ n", then call Uri.EscapeDataString for the body and subject before concatenation.
Use% 0D% 0A to split lines.
To simplify, use "\ r \ n", then call Uri.EscapeDataString for the body and subject before concatenation.
if IsBodyHtml == true, as suggested above, use <br /> You can use someText.Replace ("\ n", "<br />" ) to replace new lines (any remaining lines from r \ n lines will be ignored). Or use someText.Replace ("\ r \ n", "<br />" ). Replace ("\ n", "<br />" ) to fix both ends of the line without any leftover \ r if line-to-line mixed in the text.
"<br />"