This just a matter of having appropriate
Content-type: "text/html"
, and of course HTML context itself. Your mail body is not HTML, but I hope you know how to write it.
(More exactly, in
MailMessage
terminology, this is expressed as
ContentType.MediaType
property; please see the last link below.)
This is easy: the property
System.Net.Mail.MailMessage.IsBodyHtml
does the trick:
https://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage%28v=vs.110%29.aspx[
^].
If you want to make only part of your mail HTML, it would be more tricky. You can create multi-part mail message. Parts plays the roles of attachments with different
content-disposition
values, such as embedded in the mail text when rendered, or downloadable attachments, or alternative views or linked resource. Then each part could have its own content type; one can be HTML another one a bitmap. For further information, see also:
https://msdn.microsoft.com/en-us/library/system.net.mail.attachment%28v=vs.110%29.aspx[
^],
https://msdn.microsoft.com/en-us/library/system.net.mail.attachmentbase%28v=vs.110%29.aspx[
^],
https://msdn.microsoft.com/en-us/library/system.net.mail.attachmentbase.contenttype%28v=vs.110%29.aspx[
^],
https://msdn.microsoft.com/en-us/library/system.net.mime.contenttype.mediatype%28v=vs.110%29.aspx[
^].
Good luck,
—SA