HowTo: Find SMTP email adress of sender and recipients

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

HowTo: Find SMTP email adress of sender and recipients
 
Thanasis Boukouvalas




Posts: 40
Joined: 2006-06-17
Hi

I'm trying to find the email adresses of sender and recipients and when email is internal, I'm taking addresses like "/O=ENTERSOFT/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=Thanassis.boukouvalas".

How can I find the smtp email address of recipient?
Posted 29 Sep, 2006 11:56:06 Top
Sergey Grischenko


Add-in Express team


Posts: 7224
Joined: 2004-07-05
Thanasis, please try the following example:
http://www.add-in-express.com/projects/olgetsmtpaddressexample.zip
Posted 29 Sep, 2006 16:45:05 Top
Thanasis Boukouvalas




Posts: 40
Joined: 2006-06-17
Hi Sergey

I've tried the above example and when I compose a new mail, the MAPI Initialization is failed. (only when I open an already sent email, example works fine).


if (MAPI.MAPIInitialize(IntPtr.Zero) == MAPI.S_OK)
{
  //...
}
else
  throw new ApplicationException("MAPI can not be initialized.");


Can I do something about this?
Posted 03 Oct, 2006 05:24:03 Top
Sergey Grischenko


Add-in Express team


Posts: 7224
Joined: 2004-07-05
Hi Thanasis.

I can't reproduce the error on my PC.
Didn't you change the code?
Posted 03 Oct, 2006 09:20:22 Top
Thanasis Boukouvalas




Posts: 40
Joined: 2006-06-17
I didn't change the example.
I just run it.

I found a workaround for this.
I call MAPIInitialize, MAPILogonEx and OpenAddressBook at AddinStartupComplete and keep the addrBook IntPtr in order to use it all the other times I need it.

So, I don't have to call MAPIInitialize when I'm in the inspector of a new email and I don't take the exception anymore.

Maybe it's not an elegant solution but I overcome the MAPIInitialize failure.

(I've tested it with Outlook 2003, Exchange and Word as my e-mail editor)
Posted 03 Oct, 2006 10:30:19 Top