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.