Outlook:如何从收件人字段获取电子邮件?
我正在尝试获取在撰写邮件窗口的收件人字段中输入的电子邮件地址。
我尝试获取收件人的地址属性,根据 VS,它应该给我电子邮件。
相反,我收到的字符串如下所示:
"/c=US/a=att/p=Microsoft/o=Finance/ou=Purchasing/s=Furthur/g=Joe"
如何获取收件人字段中的电子邮件地址?
到目前为止我的代码:
List <string> emails = new List<string>();
if (thisMailItem.Recipients.Count > 0)
{
foreach (Recipient rec in thisMailItem.Recipients)
{
emails.Add(rec.Address);
}
}
return emails;
I'm attempting to get the email address typed into the To field of a compose mail window.
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;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
你能试试这个吗?
参考链接
编辑:
我没有合适的环境来测试,所以我只是猜测所有这些,但是
.Email2Adress
或.Email3Address
又如何,
您可能想尝试一下。
Can you try this ?
Reference link
EDIT:
I don't have the right environment to test so I'm just guessing all this, but how about
or
.Email2Adress
or.Email3Address
Also there is,
that you might want to try.
试试这个
这可以在 MSDN 此处
我使用过相同的在我的应用程序及其工作中获取电子邮件地址的方法。
Try this
This is available on MSDN here
I have used the same way to get email addresses in my application and its working.
AddressEntry
还有一个SMTPAddress
属性,用于公开用户的主 smtp 地址。the
AddressEntry
also has anSMTPAddress
property that exposes the primary smtp adress of the user.我不知道这是否有帮助或有多准确
I don't know if this helps or how accurate