darrellblackhawk
Programmer
Many of us have tried to figure out how to get a sender's
email address when automating Outlook before version 2003
(SenderEmailAddress).
I was just playing around with this again today and came
up with a work-around to retrieve it, even though Outlook
2002 and below doesn't expose it in its object model.
Once you've got a reference to an email item; [blue]oMailItem
in the example below[/blue], you save it using the the mail items
saveas() method, then pull out the sender's email address
which will be the last word on the first line.
e.g.
Darrell
email address when automating Outlook before version 2003
(SenderEmailAddress).
I was just playing around with this again today and came
up with a work-around to retrieve it, even though Outlook
2002 and below doesn't expose it in its object model.
Once you've got a reference to an email item; [blue]oMailItem
in the example below[/blue], you save it using the the mail items
saveas() method, then pull out the sender's email address
which will be the last word on the first line.
e.g.
Code:
#define SaveFile "PathAndFileName"
oMailItem.saveas(SaveFile,0)
cSenderAddress = filetostr(SaveFile)
cSenderAddress = left(cSenderAddress,at(chr(13),cSenderAddress)-1)
cSenderAddress = chrtran(substr(cSenderAddress,rat(" ",cSenderAddress)+1),"[]","")
Darrell