How to send email in richtext format to Outlook?

前端 未结 3 1628
囚心锁ツ
囚心锁ツ 2021-01-05 13:47

It works great to send emails (to Outlook) in HTML format by assigning the text/html content type string like so:

using (MailMessage message = new MailMessag         


        
3条回答
  •  时光说笑
    2021-01-05 14:34

    The bottom line is, you can't do this easily using System.Net.Mail.

    The rich text in Outlook is sent as a winmail.dat file in the SMTP world (outside of Exchange).

    The winmail.dat file is a TNEF message. So, you would need to create your richtext inside of the winmail.dat file (formatted to TNEF rules).

    However, that's not all. Outlook uses a special version of compressed RTF, so, you would also need to compress your RTF down, before it's added to the winmail.dat file.

    The bottom line, is this is difficult to do, and unless the client really, really needs this functionality, I would rethink it.

    This isn't something you can do with a few lines of code in .NET.

提交回复
热议问题