Send HTML Email via C# with Smtpclient

How to send HTML-formatted email?

Setting isBodyHtml to true allows you to use HTML tags in the message body:

msg = new MailMessage("xxxx@gmail.com",
"yyyy@gmail.com", "Message from PSSP System",
"This email sent by the PSSP system<br />" +
"<b>this is bold text!</b>");

msg.IsBodyHtml = true;

Generate HTML Email with .NET

Because there's no designation of IsBodyHTML set to true when using the Send function the way you've done. I think IsBodyHTML is within the MailMessage object.

I'm not entirely sure what IsBodyHTML sets in the body but it may create fully formed HTML (<html><head><body>etc....) so maybe give that a try.



Related Topics



Leave a reply



Submit