Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading a sender's email address from Outlook

Status
Not open for further replies.

garylafferty

Programmer
May 1, 2002
8
GB
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!!
 
Not very hot on this but it it could be

mailmessage.from.address

or

mailmessage.from
 
In the VBA forum I found several threads looking for this information. here is the answer I found there on how to get the sender's email address:

Not in a very straightforward way.
Check out
Leslie
landrews@metrocourt.state.nm.us

SELECT * FROM USERS WHERE CLUE > 0
No Rows Returned
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top