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?
That looks like a perfectly valid email address of type
"EX"
(as opposed to "SMTP").If you want the SMTP address, use
MailItem.Sender.GetExchangeUser().PrimarySmtpAddress
. Be prepared to handle nulls and exceptions. But first check theMailItems.SenderEmailType
property - if it is "SMTP", you can still useSenderEmailAddress
.I am using this to get the Sender Mail Address.