How to get sender SMTP e-mail address

Add-in Express™ Support Service
That's what is more important than anything else

How to get sender SMTP e-mail address
 
LarsDahl




Posts: 5
Joined: 2006-04-11
I found this post: http://www.add-in-express.com/forum/read.php?FID=5&TID=599&MID=2940

I have tried the code, and a question arises:
If the mail is comming from an Exchange server then the senders e-mail address is in the x.500 format (/0=abc/ou=def/cn=recipients/cn=ghi). Can I get the smtp-address (ghi@jkl.mn) from it/instead?

I see two possibilities, one if the Extended MAPI example can be modified to find it
- or -
To resolve it through the "Outlook Contacts or Address Book"-snippet, but can I allways be sure that it possible to lookup x.500 addresses by using it?
Posted 11 Apr, 2006 07:58:31 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Lars.

I have modified the example. Now it shows on how you can get the smtp address of the Exchange user specified in the To field of a new mail inspector.
Posted 11 Apr, 2006 13:22:30 Top
LarsDahl




Posts: 5
Joined: 2006-04-11
Hi Sergey.

Hummm... In the SMTP case it give "jdoe@example.com".
But in the EX case it give "John Doe" instead... In other words: The display name.

Well, I think that PR_SENDER_NAME is the display name. I see that asking for PR_SENDER_EMAIL_ADDRESS instead give: "/o=vaporware/ou=outnow/cn=recipients/cn=jdoe".

Is there something like the CdoPR_EMAIL (0x39FE001E)? - It does it for CDO. But if I let your code read at 0x39FE001E it find nothing. (I vaguely remember that this field is not a string but multi value, whatever that means. It could be why.)
Posted 12 Apr, 2006 04:33:17 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Lars.

The example works with 'Display Names' as well as the X400 address type.
Posted 12 Apr, 2006 06:11:50 Top
LarsDahl




Posts: 5
Joined: 2006-04-11
Hi Sergey.

Uhhh... I really feel like a wet cobblestone right now...

Are there any need for Extended MAPI to do this?
To my knowledge (Which may be wrong... Explaining why I can't comprehend what's going on!) the "SenderEmailAddress" property of an Outlook MailItem is the email address in the SMTP case, and the "SenderName" property is the display name in the EX case.

So if your "Outlook Contacts or Address Book"-code snippet to look up the SMTP address from the "SenderName" always work in the EX case (Here my problem is: Can I be sure that it always work in that case?) then I don't see any need for CDO or Extended MAPI.

Posted 12 Apr, 2006 09:24:15 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Lars, you can use the SenderEmailAddress property if Outlook is not connected to Exchange. In case when Outlook is connected to Exchange (SenderEmailAddress is X400 address), you can use my code to transform X400 address to SMTP format.
Posted 12 Apr, 2006 10:14:31 Top
LarsDahl




Posts: 5
Joined: 2006-04-11
Hi Sergey.

Seems that I'm poking around in a dead end...

Trying the code I get: "Lars Dahl" - The displayname, not "lod@xxx.yy"

Trying to convert it with the "Outlook Contacts or Address Book"-code give "/o=abc/ou=def/cn=recipients/cn=lod", still not "lod@xxx.yy".
Posted 18 Apr, 2006 08:40:44 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Lars.

Did you try to convert "/o=abc/ou=def/cn=recipients/cn=lod" address using my code in the http://www.add-in-express.com/projects/olgetsmtpaddressexample.zip example?
Posted 18 Apr, 2006 09:18:12 Top
LarsDahl




Posts: 5
Joined: 2006-04-11
Hi Sergey.

I hadn't seen that one...
But I just tried it.
*sigh of relief*
It works!
Great!
Brilliant!
Thank you!

Looks a bit like http://support.microsoft.com/kb/248357/

Though I still feel that getting a smtp-address ought to be something straight forward.
Rumours say that it will be in Office12 / Outlook 2007.
Posted 19 Apr, 2006 06:06:01 Top