【问题标题】:How to send an outlook mailitem using specific email address?如何使用特定的电子邮件地址发送 Outlook 邮件?
【发布时间】:2022-04-27 23:58:44
【问题描述】:

您好,有人知道如何使用特定的电子邮件地址字符串发送或回复 Outlook 邮件吗?

举例:

我的 Outlook 电子邮件地址是:

string email = "myOutlookEmailAddress@company.com";

现在我想使用(我的 Outlook 上特定邮箱中的电子邮件地址),而不是我的 Outlook 电子邮件地址:

string email = "otherEmailAddress@company.com";

我已经尝试过使用这个:

Outlook.Accounts accounts = application.Session.Accounts; 
foreach (Outlook.Account account in accounts) 
{ 
    // When the e-mail address matches, return the account. 
    if (account.SmtpAddress == smtpAddress) 
    { 
        return account; 
    } 
} 

但它只查找我的 Outlook 应用程序中的帐户。

【问题讨论】:

  • 所以您想从未在 Outlook 中配置的帐户发送消息?
  • @YacoubMassad 抱歉,我刚刚编辑了我的问题。
  • 那么你找到合适的Account了吗?
  • @YacoubMassad 否,因为该邮箱的电子邮件地址不在帐户设置中:(您至少知道如何访问该邮箱的电子邮件地址吗?
  • 您不能这样做,除非主帐户被授予另一个帐户的委托权限。而是与 SMTP 服务器通信。

标签: c# outlook


【解决方案1】:
  1. 如果您代表另一个邮箱通过 Exchange 发送,请设置 MailItem.SentOnBehalfOfName 属性(假设您有足够的权限)

  2. 如果您通过特定 SMTP 帐户发送,请设置 MailItem.SendUsingAccount 属性。

  3. 如果您需要作为任意 SMTP 用户发送,请参阅我网站上的 this example - 您基本上需要在 PS_INTERNET_HEADERS 命名空间中设置名为“From”的 MAPI 属性。请注意,并非所有 SMTP 服务器都允许您这样做 - Exchange for one 不会让您欺骗发件人。

  4. 如果您想作为属于特定 Exchange 邮箱的别名(代理)SMTP 地址之一发送,则需要通过 SMTP 发送 - 通过 OOM 或 MAPI 发送将始终使用邮箱的默认 SMTP 地址发送。对于最终用户,您可以配置一个虚拟 POP3/SMTP 帐户或使用像 Proxy Manager 这样的产品(我是它的作者)。请参阅MSOutlook.info 了解更多信息。

【讨论】:

    猜你喜欢
    • 2014-10-16
    • 2016-05-22
    • 2014-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多