Extract sender of emails email address


B

bony_tony

Hi, I've got the code below which extracts the subject and senders
name of emails in a specific folder, however, when I ask for
SenderEmailAddress, it is returning something like, /O=HAYS/OU=HAYS
ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=NXPEA which i'm guessing is the
internal reference for the person. How do I amend the code so that I
get their actual email address? ie (e-mail address removed)....?


Sub GetFromInbox()

Dim olApp As Outlook.Application
Dim olNs As NameSpace
Dim Fldr As MAPIFolder
Dim olMail As Variant
Dim i As Integer

Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.Folders("Public Folders").Folders("All Public
Folders").Folders("SYD").Folders("CredCheck-CP")
i = 1

For Each olMail In Fldr.Items
ActiveSheet.Cells(i, 1).Value = olMail.Subject
ActiveSheet.Cells(i, 2).Value = olMail.SenderName
ActiveSheet.Cells(i, 3).Value = olMail.SenderEmailAddress
i = i + 1
Next olMail

Set Fldr = Nothing
Set olNs = Nothing
Set olApp = Nothing

End Sub
 
Ad

Advertisements

M

Michael Bauer [MVP - Outlook]

In that case you can't read the SMTP address via Outlook object model.
Instead, you'd need to use either CDO 1.21 or Redemption
(http://www.dimastr.com). Then read PR_EMAIL (&H39FE001E) property to obtain
the SMTP address from an AddressEntry object. See
http://www.outlookcode.com/d/code/getsenderaddy.htm#redemption for an
example.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
The most effective way to assign Outlook categories:
http://www.shareit.com/product.html?productid=300120654&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am 6 Mar 2007 19:35:34 -0800 schrieb bony_tony:
 
B

bony_tony

I can't install anything like that on my work computer.
The only reason I want the email address is so that I can identify if
the person is from NZ or Australia. This information is also stored
under the senders details when I double click their name, they are
located in the global address book. Is there any way I can pull out
their Country/Region from there?

Thanks
Tony
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top