Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to give new line in mailmessage.body section

Tags:

c#

asp.net

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.

like image 791
user707294 Avatar asked Apr 26 '11 05:04

user707294


People also ask

How do you add a line in an email body?

You can then add a <br/> tag to allow a new line.

How do you add a new line in HTML body?

To add a line break to your HTML code, you use the <br> tag. The <br> tag does not have an end tag. You can also add additional lines between paragraphs by using the <br> tags. Each <br> tag you enter creates another blank line.

How do you enter a line break in mailto body command?

Use Encoding %0D%0A in mailto body to line break. This is the only valid way to generate a line break of content/text in the body.

How do I put a new line in the body of an email in PHP?

Answer: Use the Newline Characters ' \n ' or ' \r\n ' You can use the PHP newline characters \n or \r\n to create a new line inside the source code.


1 Answers

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

like image 103
turtlepick Avatar answered Oct 13 '22 00:10

turtlepick