简体   繁体   English

阻止 Outlook 将 HTML 转换为 RTF

[英]Stop Outlook from converting HTML to RTF

I'm writing an add-in for Outlook 2007. Everything works fine except when I send an email in HTML format, Outlook converts it to RTF.我正在为 Outlook 2007 编写一个加载项。一切正常,除了当我以 HTML 格式发送电子邮件时,Outlook 将其转换为 RTF。 So if the recipient opens it in eg.因此,如果收件人在例如打开它。 Thunderbird he gets a wonky looking text message instead of the nicely formatted html I sent. Thunderbird 他收到了一条看起来很奇怪的短信,而不是我发送的格式良好的 html。

Outlook.MailItem theMail = (Outlook.MailItem)((Outlook.Application)Globals.ThisAddIn.Application).CreateItem(Outlook.OlItemType.olMailItem);
Outlook.Recipient rcp = theMail.Recipients.Add("joe blow <joe@blow.com>");
rcp.Type = (int)Outlook.OlMailRecipientType.olTo;
theMail.HTMLBody = <html composed elsewhere>
theMail.BodyFormat = Outlook.OlBodyFormat.olFormatHTML;

How do I convince Outlook that I really do want html?如何让 Outlook 相信我真的想要 html?

EDIT OK - I found the problem here at MSDN I'm adding a user property编辑好的 - 我在 MSDN 上发现了问题我正在添加一个用户属性

Outlook.UserProperty prop = theMail.UserProperties.Add("theQuoteId", Outlook.OlUserPropertyType.olText);
prop.Value = quote.qid.ToString();

According to the article the property cannot be mapped to the mime headers and Outlook throws it into RTF.根据文章,该属性无法映射到 mime 标头,Outlook 将其扔到 RTF 中。

So my next problem is to figure out how to add an unique tag to the message so I can link it to a database later.所以我的下一个问题是弄清楚如何为消息添加唯一标签,以便稍后将其链接到数据库。 Any ideas?有任何想法吗?

I had this problem a few years ago.几年前我遇到过这个问题。 In the end we fixed it with an Outlook hot fix, not a code change.最后,我们使用 Outlook 热修复程序修复了它,而不是代码更改。

Look at the Outlook message in the Sent Items folder with OutlookSpy (I am its author - click IMessage button) to see if the UseTnef named property (DASL name http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8582000B ) is set to true.使用OutlookSpy (我是其作者 - 单击 IMessage 按钮)查看已发送邮件文件夹中的 Outlook 消息,以查看UseTnef命名属性(DASL 名称http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8582000B )设置为真。

It can be set if user properties are set on the message - since they cannot be preserved in MIME alone, Outlook sends in the RTF format (the infamous winmail.dat attachment).如果在邮件上设置了用户属性,则可以设置它 - 因为它们不能单独保存在 MIME 中,Outlook 以 RTF 格式发送(臭名昭著的 winmail.dat 附件)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM