Reading the part [[email protected]] of a "John Smith [[email protected]] "

  • Thread starter Thread starter michel
  • Start date Start date
M

michel

Hello,

I am pretty new in the object models linked to outlook.

I did not find the right way to read the part
[[email protected]] of the string "John Smith [[email protected]] "
which appears in the mailing adress.

I am using :
=======
Dim NS As Outlook.NameSpace
Dim Source As Outlook.MAPIFolder
Dim Mail As Outlook.MailItem

Set App = Outlook.Application
Set NS = App.GetNamespace("MAPI")
Set Mail = FldSource.Items.GetFirst

debug.print Mail.SenderName
=========

The answer of Debug.print is "John Smith" but I would like to have access to
the string (e-mail address removed).

Do I use the wrong object model ?

Thanks in advance

Michel
 
To get the actual sender email address you would need to use CDO 1.21,
an optional installation in Outlook 2000 or later. You can also create
a dummy reply item and read the Recipients collection of the dummy
item to get the original ReplyTo address but that might not be the
same as the From address.

Secure versions of Outlook will fire the security prompts if you
access the email address using CDO, so you also might want to check
out Redemption (www.dimastr.com/redemption). For a CDO code sample
showing how to get the From address see
http://www.slovaktech.com/code_samples.htm#FromAddress Make sure you
have a project reference set to CDO 1.21 and make sure it's installed
for this code to work.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm
 
Back
Top