【发布时间】:2022-05-17 06:21:55
【问题描述】:
我正在为 Outlook 2007 编写一个加载项。除了我以 HTML 格式发送电子邮件时,一切正常,Outlook 将其转换为 RTF。因此,如果收件人在例如打开它。 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;
如何让 Outlook 相信我确实需要 html?
编辑 好的 - 我在这里找到了问题 at MSDN 我正在添加用户属性
Outlook.UserProperty prop = theMail.UserProperties.Add("theQuoteId", Outlook.OlUserPropertyType.olText);
prop.Value = quote.qid.ToString();
根据文章,该属性无法映射到 mime 标头,Outlook 将其扔到 RTF 中。
所以我的下一个问题是弄清楚如何将唯一标签添加到消息中,以便稍后将其链接到数据库。有什么想法吗?
【问题讨论】:
-
是否需要设置 MIME 类型?在 HTTP 中,解释问题通常是因为发送的文件使用了错误的 MIME 类型。 (我猜
MailItem.BodyFormat是这个,但我希望缺少一些东西,因为这意味着修复相对容易......) -
我不认为它是 mime 类型 - Outlook 创建一个 rtf 正文并将其附加到电子邮件中。