Tuesday, January 25, 2005

=3D and = characters in the ASP.NET/MVC HTML emails

While trying to send an HTML email from the ASP.NET, you get the junk strange characters in the output.
Eg: 1) appending "3D" (Style type =3D"text/CSS")
2) appending "=" between a two words (cell=padding)

Modify the C# code to include the below:
MailMessage message = new MailMessage(SendFrom, SendTo);
var MyplainView = AlternateView.CreateAlternateViewFromString(msgBody,null,"text/html");
MyplainView.TransferEncoding = System.Net.Mime.TransferEncoding.SevenBit;
message.IsBodyHtml = true;

No comments:

Post a Comment