user707294 user707294 - 1 day ago 5
ASP.NET (C#) Question

how to give new line in mailmessage.body section

I have sent mail using SMTP (ASP.NET).

I have written text in one line only, but I want to be in next line.

I used

\n
, but it's not working.

Answer

System.Environment.NewLine

If you format your email as HTML you can add a <br /> to it.

To format as HTML use the IsBodyHtml property of the MailMessage class.

http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.isbodyhtml.aspx

Comments