garylafferty
Programmer
Hi,
I have got some code which will read the contents of the Inbox folder from MS Outlook, as follows:
var
outlook: OLEvariant;
namespace: OLEvariant;
folder: OLEvariant;
MailCounter: integer;
begin
outlook:=createoleobject('outlook.application');
namespace:=outlook.getnamespace('MAPI');
namespace.logon(EmptyParam,EmptyParam,False,True);
folder:=namespace.getdefaultfolder(6);
MailCounter:=1;
memo1.text:='';
while mailcounter<(folder.items.count) do
begin
MailMessage:=folder.items(MailCounter);
memo1.lines.add(mailmessage.sendername);
mailcounter:=mailcounter+1;
end;
and this works perfectly well. HOWEVER .... what I really want is the sender's email address (as opposed to the sendername).
I have tried using:
mailmessage.sender.address
but this returns an error message.
I have searched the Web for a solution to this problem, with no joy. Can anyone please help ? Thanks!!
I have got some code which will read the contents of the Inbox folder from MS Outlook, as follows:
var
outlook: OLEvariant;
namespace: OLEvariant;
folder: OLEvariant;
MailCounter: integer;
begin
outlook:=createoleobject('outlook.application');
namespace:=outlook.getnamespace('MAPI');
namespace.logon(EmptyParam,EmptyParam,False,True);
folder:=namespace.getdefaultfolder(6);
MailCounter:=1;
memo1.text:='';
while mailcounter<(folder.items.count) do
begin
MailMessage:=folder.items(MailCounter);
memo1.lines.add(mailmessage.sendername);
mailcounter:=mailcounter+1;
end;
and this works perfectly well. HOWEVER .... what I really want is the sender's email address (as opposed to the sendername).
I have tried using:
mailmessage.sender.address
but this returns an error message.
I have searched the Web for a solution to this problem, with no joy. Can anyone please help ? Thanks!!