2

我需要在外发电子邮件中包含自定义标题。

我正在使用 Microsoft Outlook 2010 和 SendGrid SMTP 服务器。

特别是,我想使用 SendGrid 的X-SMTPAPI标头在每封邮件上指定一个唯一的跟踪 ID。

我的方法:

我正在构建一个 Outlook 加载项,它将拦截传出的电子邮件并添加所需的标头 Outlook.Application对象具有用于此目的的ItemSend事件。

如何使用Mail.PropertyAccessor.SetProperty设置自定义标头?我无法找到指向 x-headers 的正确标头标识符,或者这将允许我设置自定义标头。

感谢您的帮助。

谢谢。

4

2 回答 2

4

我可以添加一个 X-header。很难找到 GUID

const string SP_INTERNETHEADERS = "{00020386-0000-0000-C000-000000000046}/";
const string internetheaderSchema = "http://schemas.microsoft.com/mapi/string/" + SP_INTERNETHEADERS;
string mailproperty = internetheaderSchema + XHeader;
MailItem olmail = ThisAddIn._Application.ActiveInspector().CurrentItem;
olmail.PropertyAccessor.SetProperty(mailproperty, value);
olmail.Save();
于 2016-07-08T09:26:28.470 回答
1

ReliefJet Essentials 的Outlook 规则集成允许这样做。您只需创建一个传出规则并选择 ReliefJet Essentials 的Set Header Value工具作为自定义操作。就这样!

于 2011-10-18T13:22:22.217 回答