Composed Mail's Account Email Address

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

Composed Mail's Account Email Address
 
Richard Plana




Posts: 5
Joined: 2007-01-10
Could I get advice on how to acquire the sender's (account) email address whenever a new email is being composed (regardless of whether the default account is being used or not)? I would prefer a solution in this order of preference: Outlook Object Model, ADX, Redemption, CDO and Extended MAPI.
Posted 14 Jan, 2007 13:22:56 Top
Sergey Grischenko


Add-in Express team


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

Please download the following example:
http://www.add-in-express.com/projects/olsendernamemodificationexample.zip


P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 15 Jan, 2007 16:05:43 Top
Esteban Astudillo


Guest


Hi Sergey,

I compiled and ran this example but I always get an empty email address in the dialog box.

Is you solution designed to work with Exchange accounts? I have tried it only in one machine where I have both POP and Exchange accounts and when I get the same result when I choose one type of account or the other in the Accounts list (POP/Ex)

I will try with another machine configure to only use POP3, but before that I wanted to confirm with you when I can expect this solution to work.

In my dev machine where I tested this I'm using Outlook 2003 and your test solution was created with VS2005. I'm using ADX.net 3.2

Thanks in advance
Esteban
Posted 09 Feb, 2007 17:49:53 Top
Sergey Grischenko


Add-in Express team


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

The project works with Exchange but the Exchange account should be the default account.

Posted 12 Feb, 2007 04:50:00 Top
Esteban Astudillo


Guest


Hi Sergey,

When I tested this the Exchange account was in fact the default account. I also tried changing this but got the same results. I have 4 accounts in Outlook: 1 Exchange, 3 POP3.

Anyway, looking at the source code I noticed that the execution is always following the same path. If I understand this correctly, your code is trying to do this (please confirm):


- Get the value of the MailItem's PR_NEWMESSAGE_SENDER_EMAIL_ADDRESS MAPI property
- If that is empty:
- Load Accounts from registry
- Return the first one in the list


In my case the PR_NEWMESSAGE_SENDER_EMAIL_ADDRESS property is always empty, so the code is always getting the Accounts information and returning the first one, which in practice it's equivalent to use the default account information in Outlook, right?

In fact, that's exactly what I get: the default account's email address, not the account used when composing the message. For example, if I set the default account in Outlook to the Exchange account I get that account name back in the ItemSend event no matter what I choose in the Accounts drop down list in the Inspector window. Same behaviour if I set one of the POP3 accounts as the default one.

Is this the expected behaviour or am I still missing something?

Thank you in advance for straighten this up for me

Esteban

PS: I found a small bug in your sample code with the two SortedList private members of the Accounts class. Let me know if you need to know more about this.
Posted 12 Feb, 2007 13:08:34 Top
Sergey Grischenko


Add-in Express team


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

For some reason I can't reproduce the issue. I have two accounts POP3 and one of the Exchange account. I always see the sender's address.
One more thing. The 'PR_NEWMESSAGE_SENDER_EMAIL_ADDRESS' constant is not a documented tag. So I can't guaranty that the code will 100% work in Outlook with mixed accounts. Now I don't have any other solution for this issue.
Posted 13 Feb, 2007 11:00:57 Top