I'm using PST-Parser to parse .pst
files. Most of this is working, but I am having a problem when a message contains a recipient who is on an Exchange server, at least, I think that's the problem.
If I look at the raw message headers in Outlook, I can see something like this...
To: Jim1 <jim1@jim.com>
Cc: Jim2 <jim2@jim.com>,
Jim3 <jim3@jim.com>,
Someone Else <someone@else.co.uk>
As you can see, the email addresses for everyone @jim.com are stored in SMTP
format, which is the format I need to display to the end user.
When I try to get the email address in code, I get something like this...
/o=ExchangeLabs/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=404f8ca9734d4114bfbb1854d6336f55-jim1
The code I'm using to get the addresses is simple enough. Given a Message
object, I can get (say) the first "To" recipient as follows...
Recipient recip = message.Recipients.To.First();
...and the email address as follows...
string email = recip.EmailAddress;
This works fine for most recipients, but for some, gives the odd code shown earlier. According to this answer (which relies on Outlook automation, which I can't use), the code shown above is a valid EX
address. However, I need the SMTP
address, eg jim1@jim.com
to display to the end user.
Anyone any idea how I can get the SMTP
address? It's clearly in the message headers, so should be available. What puzzles me is that the EX
address returned doesn't even appear in the raw headers, so I have no idea where that is coming from.
Thanks for any help you can give.