MailItem.To = 'John' instead of [email protected]

  • Thread starter Thread starter derobins
  • Start date Start date
D

derobins

Hi,

I am creating a filter which uses the To and CC property to sort
mails.
Unfortunately many mails contain the name (eg. 'John Smith') instead
of the email address (eg. (e-mail address removed)) in the To or CC
property. How can I access the email address?

Thx!
 
Do not use To/CC/BCC properties to extract addresses.
Loop through all entries in the Recipients collection and for each item read
the value of the Recipient.Address property. The Recipient.Type property
will return the recipient kidn (olTo / olCC / olBCC)

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

in message
news:[email protected]...
 
Thx for your answer :)
However, I have the same problem now for the SentOnBehalfOfName
property.
Again, it only shows me the name, but I need the email address.

I would appreciate any help,
Thank You!

Do not use To/CC/BCC properties to extract addresses.
Loop through all entries in the Recipients collection and for each item read
the value of the Recipient.Address property. The Recipient.Type property
will return the recipient kidn (olTo / olCC / olBCC)

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

in message

I am creating a filter which uses the To and CC property to sort
mails.
Unfortunately many mails contain the name (eg. 'John Smith') instead
of the email address (eg. (e-mail address removed)) in the To or CC
property. How can I access the email address?
 
OOM simply does not expose that.
You can retrieve the value of the PR_SENT_REPRESENTING_ENTRYID MAPI property
using PropertyAccessor in Outlook 2007 or Fields in CDO 1.21 and use it to
call Namespace.GetRecipientFromID.
Redemption (url below) exposes RDOMail.SentOnBehalfOf property
(returns RDOAddressEntry object)

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

in message
Thx for your answer :)
However, I have the same problem now for the SentOnBehalfOfName
property.
Again, it only shows me the name, but I need the email address.

I would appreciate any help,
Thank You!

Do not use To/CC/BCC properties to extract addresses.
Loop through all entries in the Recipients collection and for each item
read
the value of the Recipient.Address property. The Recipient.Type property
will return the recipient kidn (olTo / olCC / olBCC)

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

in message

I am creating a filter which uses the To and CC property to sort
mails.
Unfortunately many mails contain the name (eg. 'John Smith') instead
of the email address (eg. (e-mail address removed)) in the To or CC
property. How can I access the email address?
 
Back
Top