How do I send an HTML email? I use the code in this answer to send emails with SmtpClient
, but they're always plain text, so the link in the example message below is not formatted as such.
<p>Welcome to SiteName. To activate your account, visit this URL: <a href="http://SiteName.com/a?key=1234">http://SiteName.com/a?key=1234</a>.</p>
How do I enable HTML in the e-mail messages I send?
This is what I do:
MailMessage mail = new MailMessage(from, to, subject, message);
mail.IsBodyHtml = true;
SmtpClient client = new SmtpClient("localhost");
client.Send(mail);
Note that I set the mail message html to true: mail.IsBodyHtml = true;