【问题标题】:How to add custom internet headers to emails?如何在电子邮件中添加自定义 Internet 标题?
【发布时间】:2016-07-08 02:24:21
【问题描述】:

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

【问题讨论】:

    标签: visual-studio-2015 vsto outlook-addin


    【解决方案1】:

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

    // 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

    【讨论】:

    • 让我知道这是否有帮助。
    • 有没有办法正确检查是否设置了自定义标题,以防电子邮件没有设置属性。 string valueResult = CurrentMailItem.PropertyAccessor.GetProperty(PS_INTERNET_HEADERS); 返回 Null,if(CurrentMailItem.PropertyAccessor.GetProperty(PS_INTERNET_HEADERS != null); 也不起作用。
    • 尽管微软的文档是围绕 VSTO 开发的,但我真的很惊讶添加自定义电子邮件标题被保密。我发现一些官方文档引用了您列出的古怪架构 URI,但它被标记为已过时。并不能完全激发人们对这种方法将得到长期支持的信心。
    • @hcd00045,您愿意分享您提到的参考资料吗?
    • @SpencerWilliamson -- 天哪,那是几年前的事了。我会四处看看,但我不太乐观,我会找到它。 :-/
    猜你喜欢
    • 2011-03-06
    • 2018-01-07
    • 1970-01-01
    • 1970-01-01
    • 2013-06-04
    • 2019-12-24
    • 2021-07-29
    • 1970-01-01
    • 2011-11-08
    相关资源
    最近更新 更多