使用 RTF 文本作为正文发送邮件
我正在尝试使用一些 RTF 文本作为 mail.body 创建邮件消息,但 System.Net.Mail.MailMessage
上没有 IsRtfBody 属性,只有 IsHtmlBody。我收到的测试邮件均包含
{\rtf1\deff0{\fonttbl{\f0 Times New Roman;}{\f1 Verdana;}}{\colortbl\red0\green0\blue0 ;\red0\green0 \blue255 ;}{\*\listoverridetable}{\stylesheet {\ql\cf0 正常;}{\*\cs1\cf0 默认段落字体;}{\*\cs2\sbasedon1\cf0 行号;}{\*\ cs3\ul\cf1\ulc1 Hyperlink;}}\sectd\pard\plain\ql{\f1\fs20\cf0 Beste }{
等等...
我很确定这是可以完成的,因为 Outlook 有RTF 选项也可以,但在网上找不到任何合适的示例,这就是我到目前为止所拥有的:
System.Net.Mail.MailMessage oMessage = GetMailMergeMessage();
oMessage.Subject = this.MailMerger.Subject;
oMessage.Body = this.MailMergeResult.RtfText;
oMessage.IsBodyHtml = true;
oMailer.Send(oMessage);
希望有人可以帮助我,
尤尔詹。
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 Hyperlink;}}\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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,这是不可能的。
此外,Outlook 不只是将普通 RTF 作为正文发送。它的作用是将 RTF 内容封装在 TNEF 消息中。
此外,RTF 是一种特殊的压缩 RTF。它不仅仅是像您所看到的那样的普通 RTF。
执行此操作的唯一方法是将 RTF 压缩为 MS 标准,将其封装在 TNEF 消息中,然后将其附加为 winmail.dat 附件。
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.