Konrad Viltersten Konrad Viltersten - 7 months ago 8
HTML Question

Is it possible to render a mail as HTML?

I'm sending a mail using the default MailMessage, MailAddress and SmptClient combo. It works dandy but then I figured that the links would look a bit nicer if they were HTML-ized.

I've tried to copy the contents of emails that render in my mail client as HTML but didn't really succeeded. Then, I've googled quite a lot and there ae a bunch of resources but all target a more professional and heavy-duty compositions.

The only thing I want is to code it a tiny, whiny little bit of HTMLization into the mailing and my question is if there's some character sequence enabling that. Or perhaps something small and as defaulty as possible.

If the easiest alternative is to go with some heavy-duty package, I'll probably keep sending plain text messages with all the ugly links and no images nor coloring. I don't like my recipients all that much, really. :)

Answer

Consider this to send emails with HTML

{
  MailMessage mail = new MailMessage();

  mail.From ...
  mail.To ...
  mail.Subject ...
  mail.Body ...

  mail.IsBodyHtml = IsHtml;

  smtp.Send(mail);
}
Comments