如果用户是活动目录用户,如何获取发件人的电子邮件地址? [英] How to get sender's email address if user is an active directory user?
问题描述
我正在使用Outlook :: _ MailItem对象的get_SenderEmailAddress()获取发件人的电子邮件地址.但是,如果用户是活动目录用户,则receiveitem.address如下所示:/o = organizationg/ou = exchange管理组/cn = recipients/cn = xxxxxxxxxx .
I am using get_SenderEmailAddress() of Outlook::_MailItem object to get sender's email address. But if user is an active directory user, then recipientitem.address looks like this: /o=organizationg/ou=exchange administrative group /cn=recipients/cn=xxxxxxxxxx.
还有其他方法可以获取发件人的电子邮件地址吗?
Is there any other way to get sender's email address?
推荐答案
这看起来像类型为"EX"
的完全有效的电子邮件地址(与"SMTP"相对).
That looks like a perfectly valid email address of type "EX"
(as opposed to "SMTP").
如果需要SMTP地址,请使用MailItem.Sender.GetExchangeUser().PrimarySmtpAddress
.准备处理null和异常.
但是首先检查MailItems.SenderEmailType
属性-如果它是"SMTP",您仍然可以使用SenderEmailAddress
.
If you want the SMTP address, use MailItem.Sender.GetExchangeUser().PrimarySmtpAddress
. Be prepared to handle nulls and exceptions.
But first check the MailItems.SenderEmailType
property - if it is "SMTP", you can still use SenderEmailAddress
.
这篇关于如果用户是活动目录用户,如何获取发件人的电子邮件地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!