Outlook:如何从“收件人"字段获取电子邮件? [英] Outlook : How to get email from Recipient field?

查看:156
本文介绍了Outlook:如何从“收件人"字段获取电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在撰写邮件窗口的 To 字段中键入电子邮件地址.

I'm attempting to get the email address typed into the To field of a compose mail window.

我尝试获取收件人的Address属性,根据VS,它应该给我发送电子邮件.

I try to get the Address property of a Recipient, which according to VS, should give me the email.

相反,我收到的字符串看起来像这样:

I am instead receiving a string that looks like this:

"/c=US/a=att/p=Microsoft/o=Finance/ou=Purchasing/s=Furthur/g=Joe"

如何在收件人字段中获取电子邮件地址?

How can I get the email address in the recipient field?

到目前为止,我的代码:

My code so far:

List <string> emails = new List<string>();

if (thisMailItem.Recipients.Count > 0)
{
    foreach (Recipient rec in thisMailItem.Recipients)
    {
        emails.Add(rec.Address);
    }
}
return emails;

推荐答案

可以尝试吗?

emails.Add(rec.AddressEntry.Address);

参考链接

我没有合适的环境进行测试,所以我只是在猜测所有这些,但是怎么办

I don't have the right environment to test so I'm just guessing all this, but how about

string email1Address = rec.AddressEntry.GetContact().Email1Address;

.Email2Adress.Email3Address

也有

rec.AddressEntry.GetExchangeUser().Address

您可能想尝试的.

这篇关于Outlook:如何从“收件人"字段获取电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆