How to get the "real" email address?

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

How to get the "real" email address?
 
Esteban Astudillo




Posts: 146
Joined: 2006-02-27
This might be a weird question and I hope I can explain it. By the way, this is not an issue with ADX; I'm just hoping one of you might provide an insight on how to do this.

Say you have 2 email accounts in Outlook. If I send you an email to both of your email addresses (using the To and CC fields, for example), your Outlook will retrieve the "same" message from the two different email servers accordingly.

How can you tell programatically which one was downloaded from one account or the other? The "To" and "Cc" information will be the same in both, so I can't use that to distiguish between the two.

I guess what I really need is how to get the account used to retrieve a specific mail item. Is this possible or this information is lost once the email is retrieved? I don't think this is the case because after downloading the messages I can still create a Rule in Outlook to move the emails received from one account to another folder. So, I'm sure that the email item in itself contains this information.

Does this make sense? Thank you in advance if you can provide me with a hint on how to do this.

Posted 07 Mar, 2006 14:36:05 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Hi Esteban.

You can download an example using the following link:
http://www.add-in-express.com/projects/getsenderemailexample.zip
Posted 07 Mar, 2006 15:58:07 Top
Esteban Astudillo




Posts: 146
Joined: 2006-02-27
Thank you for your reply Sergey. I had already downloaded this example and I'm in fact using it, thanks. However, I'm afraid it doesn't help in this case (unless I'm missing something)

The sample code gets the Sender's email address, while what I need is the Recipient's email address instead.

Just to be clear, a code like this doesn't help me in this case either:

MailItem.To

Because in the scenario I described (two accounts in Outlook receiving the same email message) I wouldn't know which email address is the one that I received it from.

Thanks anyway, but if you have any other tip it would be greatly appreciated. Thanks a lot!
Posted 07 Mar, 2006 16:12:48 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Esteban, you just need to use the PR_DISPLAY_TO or PR_DISPLAY_CC tags insead of the PR_SENDER_EMAIL_ADDRESS tag.
Posted 07 Mar, 2006 17:12:16 Top
Esteban Astudillo




Posts: 146
Joined: 2006-02-27
You are right. After I posted that message I realized that I needed to know the appropriate constant value. I found the MAPITAGS.H file and added a couple more that I needed.

I ended up using PR_RECEIVED_BY_EMAIL_ADDRESS instead and probably will try your technique to check for the TYPE first, just like you do in the Sender's example.

Awesome support! Thank you so much!
Posted 07 Mar, 2006 17:18:39 Top