Hello,
To get the e-mail address from the inbox items you can do the following below.
But if the e-mail comes from a
smtp server the adddress will be like "/o=provider/ou=first/cn=recipients/cn=DelphiLover"
Anybody know how to obtain the real address?
Oh, don't just look on the web and come with a non-code, because I've tried them all and they all fail!! The source that you'll find will look like :
"obj.GetAddressEntry(strAddressEntryID).Fields(Cdo PR_EMAIL).Value;" (where CdoPR_EMAIL = $39FE001E)
and this will not work.
Delphi-Quellcode:
var obj: OleVariant;
emailaddress:
string;
Item,objMsgs, objFolder, objAddressEntry : OleVariant;
begin
obj := CreateOleObject('
MAPI.Session');
obj.Logon('
','
',False,False);
objFolder:=obj.Inbox;
objMsgs:=objFolder.Messages;
Item:=objMsgs.GetFirst;
objAddressEntry:=Item.Sender;
emailaddress:=objAddressEntry.Address;
Showmessage(emailaddress);
End;