Re: VC6 Add-in email issues

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Sue Mosher [MVP-Outlook] (suemvp_at_outlookcode.com)
Date: 02/01/05


Date: Tue, 1 Feb 2005 12:13:14 -0500

Sorry, that was my fault for reading VB for VC and not steering you to
Extended MAPI in the first place.

If you want the SMTP address from an Exchange DL, you can't use
MailItem.Recipients(1).Address. Outlook knows nothing about SMTP addresses
for Exchange aco***. You'll need to drop into ExMAPI again and use the
PR_EMAIL field.

-- 
Sue Mosher, Outlook MVP
Author of
     Microsoft Outlook Programming - Jumpstart for
     Administrators, Power Users, and Developers
     http://www.outlookcode.com/jumpstart.aspx
"Mark Smith" <its@online.nospam> wrote in message 
news:eVWlI4HCFHA.608@TK2MSFTNGP15.phx.gbl...
> Thanks for your help!  Incidentally I did figure out a way to get the 
> sender's mail address without using these methods.  In C++ there is a 
> MailItem::get_MAPIOBJECT function which returns the MAPI IMessage 
> interface, from which you can get the sender's address, among other 
> things.  I imagine this is similar to what the Redemption library does.
>
> As for my other question, I guess I wasn't clear enough.  Let me try 
> again. I send an email address from Outlook to a distribution list, 
> all@domain.com (distribution is handled by the server), which includes my 
> email address.  I download the message in Outlook.  When I look at 
> MailItem.Recipients(1).Address, I see "all", not all@domain.com.  Is there 
> a way to ensure that I get the whole address, including the domain, 
> "domain.com"?
>
> Mark
>
> "Sue Mosher [MVP-Outlook]" <suemvp@outlookcode.com> wrote in message 
> news:eUsUQ$8BFHA.3096@TK2MSFTNGP14.phx.gbl...
>> In Outlook 2003, you can use the MailItem.SenderEmailAddress, but note 
>> that it's subject to security prompts.
>>
>> In earlier versions, there is no Outlook property that returns the 
>> sender's email address. You can either use CDO (or Redemption to avoid 
>> security prompts -- http://www.dimastr.com/redemption/) to get the From 
>> address or use Outlook to get the Reply To address. Sample code at 
>> http://www.outlookcode.com/d/code/getsenderaddy.htm
>>
>> To get the SMTP address from an Exchange sender or recipient, use CDO or 
>> Redemption and the PR_EMAIL (&H39FE001E) MAPI property to obtain the SMTP 
>> address from the AddressEntry object. See 
>> http://www.outlookcode.com/d/code/getsenderaddy.htm#redemption and 
>> http://www.cdolive.com/cdo5.htm#EMailAddressOfSender for examples.
>>
>> To answer you're other question, the first recipient address would be 
>> MailItem.Recipients(1).Address
>>
>> "Mark Smith" <its@online.nospam> wrote in message 
>> news:uvjRcq7BFHA.904@TK2MSFTNGP12.phx.gbl...
>>>I am trying to write an Add-In (VC6) that allows me to export an email to 
>>>another program.  I am currently working with Outlook 2000. Most things 
>>>are working fine, but there are a few things I can't figure out.
>>>
>>> There doesn't seem to be any way to get the email adress of the sender 
>>> of an email.  The MailItem object has GetSenderName and 
>>> GetSentOnBehalfOfName, but these just give me the display name.  Is 
>>> there some kind of look up I can do given the display name?  Or some 
>>> other way to get the sender's address?
>>>
>>> Also, if I receive an email that is sent to an address without a domain 
>>> (e.g. just to NAME, not to NAME@DOMAIN), is there any way to get that 
>>> domain?  I tried the Recipients::ResolveAll method, but that didn't do 
>>> anything.

Quantcast