Getting SMTP address for MailItem sender

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

Getting SMTP address for MailItem sender
 
Simon Gosney




Posts: 21
Joined: 2007-11-01
Hi

I've been looking at the example referenced at http://www.add-in-express.com/forum/read.php?a&FID=5&TID=3248&MID=15459&phrase_id=1259387

However, I don't know how to get the equivalent of

ns = OutlookHost().Session;
recpt = ns.CurrentUser;
email = recpt.Address;

from a MailItem object.

The only property that seems to reference the sender is SenderName, which simply contains the sender's name.

How can I retrieve the equivalent of recpt.Address for the sender from a MailItem object (I'm using Outlook 2003)?

Many thanks, and regards

Simon
Posted 20 Jan, 2009 10:21:28 Top
Eugene Astafiev


Guest


Hi Simon,

You can use the Namespace class to get the current user. For example:

Outlook.NameSpace ns = OutlookApp.GetNamespace();
recpt = ns.CurrentUser;
...
Posted 20 Jan, 2009 10:43:49 Top
Simon Gosney




Posts: 21
Joined: 2007-11-01
Hi Eugene

Thanks for the info.... my problem is slightly different however:

I have an object of type MailItem and I am attempting to extract the sender's email address from it. I can see from the example how I can convert the "Exchange" formatted address to SMTP address, but I don't know how to get the "Exchange" format address from the MailItem object?

thanks

Simon
Posted 20 Jan, 2009 10:48:42 Top
Eugene Astafiev


Guest


Simon,

You can use the MAPI Store Accessor component to get the job done. Please read more about it http://www.add-in-express.com/products/mapi-store-events.php.
Posted 20 Jan, 2009 11:02:53 Top
Simon Gosney




Posts: 21
Joined: 2007-11-01
Hi Eugene

That's great, I will read the information and hopefully move on from there!

regards

Simon
Posted 20 Jan, 2009 11:09:37 Top
Eugene Astafiev


Guest



You are welcome, Simon.
Posted 20 Jan, 2009 11:14:27 Top