Converting exchange email to smtp email

2019-03-05 11:00发布

问题:

Is it possible to convert the exchange email to smtp email. I could find some help while googling, but the solutions are not feasible as I'm using the older version (outlook 2003).

When I check MailItem.SenderEmailAddress property the values in the property looks like this format

/O=MYCOMPANY/OU=COUNTRY/CN=RECIPIENTS/CN=joseph

I want to convert this to smtp email which should be

joseph@mail.com

回答1:

I am using this way for my .Net:

service.ResolveName(emailAddress.Address).First().Mailbox.Address
// emailAddress.Address = "/o=ExchangeLabs/ou=Exchange(abc)/cn=Recipients/cn=xyz"
// => abc@xyz.com

ResolveName method reference: https://msdn.microsoft.com/en-us/library/dd635548(v=exchg.80).aspx

I am using .Net instead of VBA. However hope will inspire your VBA code.



回答2:

MailItem.Sender.GetExchangeUser().PrimarySmtpAddress

I know this works for Outlook 2010, but your mileage may vary with 2003.



回答3:

I found the solution at this link.

http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_26868648.html

Its a simple and effective solution.