问题
I've searched and searched for an answer so I'll post this here. I'm trying to create a macro that will move 2 week old messages from my inbox to a specific folder I created for each of my coworkers. The macro successfully loops though all inbox message older than two weeks. However, when I use the .SenderEmailAddress
it retuns a huge string of characters instead of ###@####.com. How do I just get the senders email address?
Without giving the exact string (security issue), here is what I get with "X"'s in place of some characters:
/o=XXXXXXX/ou=Exchange Administrative Group (XXXXXXXXXXXXXXX)/cn=Recipients/cn=XXXXX@XXXXX
At the end of the string is the Subject line text.
Any help would be greatly appreciated! :-)
回答1:
This is a perfectly valid EX type address (as opposed to SMTP).
Try to use MailItem.Sender.GetExchangeUser().PrimarySmtpAddress.
You will need to check for nulls/errors of course in case the sender is not an Exchange user or if the address cannot be retrieved.
回答2:
This MSDN documentation will help.
来源:https://stackoverflow.com/questions/16945487/ms-outlook-2010-senderemailaddress-returns-a-huge-string-of-characters