Getting the senders's email address, really this simple..? (Delphi)

Add-in Express™ Support Service
That's what is more important than anything else

Getting the senders's email address, really this simple..? (Delphi)
 
Johnny Bravenboer




Posts: 13
Joined: 2006-03-20
Hi again,

I was looking for a way to retrieve the sender's email address from a received message and after some research this is pretty much what I could come up with:


{------------------------------------------------------------------------------}
function MyAddin.GetSenderAddress(pvIMail : MailItem) : STRING;
VAR lvNMail : MailItem;
BEGIN
   Result := '';
   TRY
      lvNMail := pvIMail.Reply;
      Result  := lvNMail.Recipients.Item(1).Get_Address;
      lvNMail.Delete;
   EXCEPT
      MessageDlg('The message does not appear to have a sender address!',
                  mtWARNING, [mbOK], 0);
   END;
END;
{------------------------------------------------------------------------------}


Is it really this simple..?

Thanks and regards,

John... ;)
Posted 07 Apr, 2006 02:20:59 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi John,

Yes, that simple.

Posted 07 Apr, 2006 07:43:46 Top
Kristjan H




Posts: 27
Joined: 2005-10-29
But in my code its soo slow??? It takes about 1-2 minute to return address?

Any help needed.

Kris


if OutlookApp.ActiveExplorer.Selection.Count > 0 then begin
IDsp := OutlookApp.ActiveExplorer.Selection.Item(1);
if Assigned(IDsp) then
try
IDsp.QueryInterface(IID__MailItem, IMail);
if Assigned(IMail) then
try

lvNMail := imail.Reply;
status(lvNMail.Recipients.Item(1).Get_Address);
lvNMail.Delete;
// IMail.Subject := 'New Subject';
// IMail.Save;
finally
IMail := nil;
end;
finally
IDsp := nil;
end;
end;
Posted 07 Apr, 2006 14:27:31 Top
Kristjan H




Posts: 27
Joined: 2005-10-29
I found that this hanging only occurs when im not connected to my Exchange server and Offline mode is not activated. Is there any workarounds?

I think that Outlook is trying to save new reply message to somewhere but no successs because of lost connection to EXCH server

Posted 07 Apr, 2006 16:54:31 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Kristjan,

Is there any workarounds?

I think you may try to use Extended MAPI or CDO for getting a sender's email address.

Posted 10 Apr, 2006 09:17:32 Top