如何向电子邮件添加自定义 Internet 标头?

问题描述:

有人可以提供如何创建自定义 Internet 标题并将其添加到 mailItem 以及以后如何阅读它们吗?我正在尝试在发送的每封电子邮件中附加一个关键字,以便其他 Outlook 客户端使用相同的加载项读取.

Can someone provide how to create and add custom internet headers to the mailItem and how to read them later? I am trying to attach a keyword to every email that is sent so it can be read by another outlook client with the same add-in.

假设您正在编写 Outlook 插件(基于您的标签).获取当前邮件项目的句柄(草稿形式的电子邮件)...

Assuming you're writing a Outlook Plugin (based on your tag). Get a Handle on your current mail item (email in draft form)...

// Describes your Custom Header
string  PS_INTERNET_HEADERS = "http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/Custom-Property-Name";

// Sets Your Custom Header
CurrentMailItem.PropertyAccessor.SetProperty(PS_INTERNET_HEADERS, "ValueOfCustomProperty" );

// Reads Your Custom Header
string valueResult = CurrentMailItem.PropertyAccessor.GetProperty(PS_INTERNET_HEADERS);

你可能会像这样逃脱:

// Sets Your Custom Header
CurrentMailItem.PropertyAccessor.SetProperty("CustomHeaderName", "ValueOfCustomProperty" );

// Reads Your Custom Header
string valueResult = CurrentMailItem.PropertyAccessor.GetProperty("CustomHeaderName");

另外,请查看:https://social.msdn.microsoft.com/Forums/office/en-US/b4218b03-d495-459f-a112-8d4e1e05ad3e/set-custom-headers-to-outlook-mailitem?forum=outlookdev