sender's e-mail address

  • Thread starter Thread starter Mark Smith
  • Start date Start date
M

Mark Smith

I am catching the Send event of a MailItem. At this point there isn't any
sender specified yet. Is there a way to get the sender's name and e-mail
address that will be added to the e-mail when it gets sent?

Mark
 
In most cases you can assume that it is the same address as the one from
Namespace.CurrentUser
If the user selected a different account, you can use the recently
documented IOlkAccountManager interface if you arre using Extended MAPI..

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
So there is no way of getting this in Outlook 2000 and newer that doesn't
result in security prompts?

Mark
 
Is there a way to get the IMAPISession from the IMessage retrieved by
MailItem::get_MAPIOBJECT? If I can do that I should be able to get the
current user.

Alternatively, I can try to create a shared MAPI session and get the user
from that session. The only thing I'm concerned about is that the shared
MAPI session might be the wrong one. For example, if someone is running
GroupWise and it is the default e-mail program, would creating a shared MAPI
session connect to GroupWise instead of Outlook, even though the code is
running in Outlook's program space? If this is a potential problem, is
there a way to tell what program we are talking to with the MAPI session?

Mark
 
Then you will need to either call MAPILogonEx or write an Exchange Client
Extension that will retrieve IMAPISession directly from Outlook using
IExchExtCallback::GetSession.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
I assume I would have to be running Exchange in order to use
IExchExtCallback::GetSession. That I can't be assured of.

MAPILogonEx is working fine. What about whether I may be getting a
different Extended MAPI client than Outlook from MAPILogonEx? And is there
a way to tell if it is Outlook or another client?

Mark
 
1. Nope, IExchExtCallback is an interface used by the Exchange Client
Extensions, which is the precursor of the COM addins. It does *not* require
Exchange Server: the name comes from the Exchange Client, which is what
Outlook used to be years back.
Exchange Client Extensions work in all versions of Outlook.
2. There aren't any other MAPI clients except Outlook (or the old Exchange
Client). There used to be SharkMail, but I don't think it is really used
nowadays.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
1. That sounds promising. I know nothing about Exchange Extensions. Can
you point me to someplace where I can learn about creating a simple Exchange
Extension?

2. GroupWise is an ExMAPI client. I currently have it installed on my
machine, and if it is set as the default e-mail program, the user I get is
"Unknown", rather than a usable e-mail address, which is what I get if
Outlook is the default e-mail program.

Thanks,
Mark
 
1..
http://msdn.microsoft.com/library/d...l/_mapi1book_iexchext_iunknown.asp?frame=true
Also try to find a copy of "Developing Applications for Microsoft® Exchange
with C++" (out of print for ages)

2. No, GW simply installs its MAPI providers if your machine has Outlook
installed.
Lotus Notes does the same. You too can create own providers to implement
your stores/address books/transports on top of your proprietary backend.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Back
Top