Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Outlook: Mailadresse der aktuell fokusierten Mail (https://www.delphipraxis.net/167672-outlook-mailadresse-der-aktuell-fokusierten-mail.html)

erich.wanker 12. Apr 2012 17:50

AW: Outlook: Mailadresse der aktuell fokusierten Mail
 
Hab es jetzt geschafft :thumb: ..

Vielen Dank an Alle!

Mit freundlichen Grüßen
Erich


Delphi-Quellcode:

procedure TForm1.SpeedButton2Click(Sender: TObject);
var
    i,j                             : Integer;
    NmSpace                         : OleVariant;
    Nachricht,MyReply               : MailItem;
    ARecipient                      : Recipient;
    seMailAddress                   : String;
    MailRecipients, ReplyRecipients : Recipients;

Begin

OutlookApplication1.Connect;
NmSpace      := OutlookApplication1.GetNamespace('MAPI');
NmSpace.Logon ('', '', False, False);


//ShowMessage('Anzahl markierte Mails: '+ inttostr(OutlookApplication1.ActiveExplorer().Selection.Count));

try
if OutlookApplication1.ActiveExplorer().Selection.Count > 0 then
begin
          Nachricht:= OutlookApplication1.ActiveExplorer.Selection.Item(1) as _MailItem;
          label1.Caption:=(
          'Sender : '+Nachricht.SenderName+#13+
          'Subjekt : '+Nachricht.Subject+#13+
          'Mailadresse : '+Nachricht.SenderName+#13+
          'Empfänger : '+Nachricht.To_);



    memo1.Lines.Clear;


    MyReply := Nachricht.Reply;
    MailRecipients := Nachricht.Recipients;
    ReplyRecipients := MyReply.Recipients;


    for j := 1 to MailRecipients.Count do
    Begin
    ARecipient := MailRecipients.Item(j);
    seMailAddress := ARecipient.Address;
    If Pos('@',seMailAddress) > 0 Then memo1.Lines.Append('* '+seMailAddress);
    End;


    for j := 1 to ReplyRecipients.Count do
    Begin
        ARecipient := ReplyRecipients.Item(1);
        seMailAddress := ARecipient.Address;
        If Pos('@',seMailAddress) > 0 Then
         begin
          memo1.Lines.Append('+ '+seMailAddress);
          label2.Caption:= seMailAddress;
         end;
    end;

end; //  if OutlookApplication1.ActiveExplorer().Selection.Count > 0

except
Label2.Caption:='Fucking Fehler';
end;

end;//   procedure

end.


Alle Zeitangaben in WEZ +1. Es ist jetzt 15:00 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz