开发者

Send mail using RTF text as Body

开发者 https://www.devze.com 2022-12-21 18:29 出处:网络
I\'m trying to create a mail message using some RTF text as the mail.body, but there\'s no IsRtfBody property on System.Net.Mail.MailMessage only IsHtmlBody. The test-mails I\'ve received all contain

I'm trying to create a mail message using some RTF text as the mail.body, but there's no IsRtfBody property on System.Net.Mail.MailMessage only IsHtmlBody. The test-mails I've received all contain

{\rtf1\deff0{\fonttbl{\f0 Times New Roman;}{\f1 Verdana;}}{\colortbl\red0\green0\blue0 ;\red0\green0\blue255 ;}{\*\listoverridetable}{\stylesheet {\ql\cf0 Normal;}{\*\cs1\cf0 Default Paragraph Font;}{\*\cs2\sbasedon1\cf0 Line Number;}{\*\cs3\ul\cf1\ulc1 Hy开发者_StackOverflow社区perlink;}}\sectd\pard\plain\ql{\f1\fs20\cf0 Beste }{ etc...

I'm pretty sure that it can be done since outlook has the RTF option also, but can't find any suitable examples online, this is what I have so far :

        System.Net.Mail.MailMessage oMessage = GetMailMergeMessage();

        oMessage.Subject = this.MailMerger.Subject;
        oMessage.Body = this.MailMergeResult.RtfText;
        oMessage.IsBodyHtml = true; 

        oMailer.Send(oMessage);

Hope someone can help me,

Jurjen.


Nope, it can't be done.

Also, Outlook does not send just normal RTF as a body. What it does, is encapsulate the RTF content inside of a TNEF message.

Also, the RTF is a special kind of compressed RTF. It is not just normal RTF like you are looking at.

The only way to do this, would be to compress the RTF to MS standards, encapsulate it in a TNEF message, and then attach it as a winmail.dat attachment.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号