绑定ApplicationEvents_11_ItemSendEventHandler后Outlook是否修改邮件格式及原因?
问题:绑定ItemSend事件后Outlook邮件格式变为TNEF(winmail.dat)
我发现执行以下操作时邮件格式发生了变化:
private void button1_Click(object sender, RibbonControlEventArgs e) { //var mail = new MailForm(); //mail.ShowDialog(); Outlook.Application outlookApp = Globals.ThisAddIn.Application; outlookApp.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookApp_ItemSend); try { Outlook.MailItem mailItem = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem); Outlook.UserProperty mailUserProperty = mailItem.UserProperties.Add("MyCustomProperty", Outlook.OlUserPropertyType.olText, false, Outlook.OlFormatText.olFormatTextText); mailUserProperty.Value = "This is from my procedure"; mailItem.Display(true); // Pass 'true' to make the window modal outlookApp.ItemSend -= new Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookApp_ItemSend); } catch (System.Exception ex) { Forms.MessageBox.Show("An error occurred: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
发送到Thunderbird客户端的邮件包含以下内容:
X-MS-TNEF-Correlator: 000000006369751F17599447AC12B6C7A882F623A4732100 ------=_NextPart_000_0001_01D9BE1B.AE7FB620 Content-Type: application/ms-tnef; name="winmail.dat" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="winmail.dat"
而未监听ItemSend事件时的常规邮件内容如下:
------=_NextPart_000_0005_01D9BE1B.B597D000 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
似乎绑定ItemSend事件前后有因素改变了邮件内容,能否有人对此进行确认?
更新
我查阅资料后发现以下说明:
如何控制邮件中的TNEF
您可以通过三种方法之一控制TNEF:
全局设置 - 如果将默认邮件格式更改为纯文本或HTML,可确保不会发送TNEF,除非Outlook功能需要它。
是否是这个原因:“除非Outlook功能需要它”?
内容的提问来源于stack exchange,提问作者Dejan Dozet
相关产品推荐
相关产品推荐

