【问题标题】:Get the SMTP sender address from new opened Outlook mail inspector with C# (VSTO or redemption) when multiple accounts configured配置多个帐户时,使用 C#(VSTO 或兑换)从新打开的 Outlook 邮件检查器获取 SMTP 发件人地址
【发布时间】:2014-07-11 14:48:54
【问题描述】:

我尝试了不同的方法,但是当可以在 Outlook 中选择多个帐户时,我无法找到一种方法来确定从 Outlook 2007 到 Outlook 2013 的可靠发件人地址。

我的插件是基于 Add-In Express 构建的。

目的是从一个活跃的new邮件项(活跃的邮件检查器)获取帐户发件人地址。

inspector = (AddinModule.CurrentInstance.OutlookApp as Outlook.Application).ActiveInspector();
mailitem = inspector.CurrentItem as Outlook.MailItem;

在 Outlook 2013 中可以使用:

mailitem.SendUsingAccount.CurrentUser.AddressEntry.Address

当我的加载项在 Outlook 2010 或 2007 上运行时,如何获取发件人地址?

【问题讨论】:

    标签: c# outlook ms-office vsto outlook-redemption


    【解决方案1】:

    SendUsingAccount 是在 Outlook 2007 中添加的,所以你应该没问题。 我不确定您为什么要使用mailitem.SendUsingAccount.CurrentUser.AddressEntry.Address - 您将始终获得默认 Outlook 帐户的地址。 你试过用mailitem.SendUsingAccount.SmtpAddress吗?

    【讨论】:

    • 感谢您的热情!真奇怪。在我通过单击“发件人”下拉菜单更改邮件检查器中的发件人地址之前,SendUsingAccount 属性为空。如何解决这个问题?
    • 你知道为什么这个属性是空的吗?谢谢!
    • 除非明确设置帐户,否则您将返回 null。在这种情况下,您可以假设使用了默认帐户。
    • 好的 - 如果值为空,我将采用默认帐户地址。非常感谢!
    猜你喜欢
    • 1970-01-01
    • 2018-03-06
    • 1970-01-01
    • 2021-03-14
    • 2021-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-13
    相关资源
    最近更新 更多