What does MailMessage.IsBodyHtml do?

前端 未结 3 1747
情书的邮戳
情书的邮戳 2020-12-10 01:21

I\'m testing sending out some emails via C#, but I can\'t tell what effect setting IsBodyHtml to true has. Regardless of the value, whatever I sen

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-10 01:55

    I just wrestled with this same problem. My best solution was to avoid setting the Body property of the MailMessage object at all. Instead just add two AlternateViews, first a plain text then an HTML. Make sure to add the plain text version first because the MIME standard says that:

    The formats are ordered by how faithful they are to the original, with the least faithful first and the most faithful last.

    That means, that you put the plain text version first, so the clients should use the HTML version if possible.

提交回复
热议问题