Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I need to sent mail from my project.I can sent mail from my project but the mail content is not formatted.All new lines are eliminated from the mail when it reaches the destination.Why it comes so please help.

Regards,
Shefeek
Posted
Comments
Prerak Patel 14-Sep-11 2:51am    
Share some code.
shefeekcm 14-Sep-11 3:32am    
it contain only mail sending code.when we pick it from the database its k fine .But when it reaches the destination the problem comes.

If your body contains "normal" line breaks ("\n" or Environment.Newline) and you have your email set as "Send as HTML" then the newlines will be ignored - they need to be "<br /> instead.
One way to do this is to replace them:
C#
string body = "hello\nthere\nthis\nis\text\n";
body = body.Replace("\n", "<br />");
 
Share this answer
 
sir;
I think you should set the property HTMLBody to true and you set the body to an html string.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900