begin
If opendialog1.Execute then begin
{stTemp := Statusbar1.Panels[1].text;
if lvHeaders.Selected = nil then
begin
Exit;
end; }
//Showbusy(true);
Msg.Clear;
Memo1.Clear;
//lvMessageParts.Items.Clear;
From.Caption := '';
Cc.Caption := '';
Subject.Caption := '';
Date.Caption := '';
Receipt.Caption := '';
Organization.Caption := '';
Priority.Caption := '';
pnlAttachments.visible := false;
//get message and put into MSG
//ShowStatus('Retrieving message "' + lvHeaders.Selected.SubItems.Strings[3] + '"');
//POP.Retrieve(lvHeaders.Selected.Index + 1, Msg);
msg.LoadFromFile(opendialog1.FileName);
//statusbar1.Panels[0].text := lvHeaders.Selected.SubItems.Strings[3];
//Setup fields on screen from MSG
From.Caption := Msg.From.Text;
Recipients.Caption := Msg.Recipients.EmailAddresses;
Cc.Caption := Msg.CCList.EMailAddresses;
Subject.Caption := Msg.Subject;
Date.Caption := FormatDateTime('dd mmm yyyy hh:mm:ss', Msg.Date);
Receipt.Caption := Msg.ReceiptRecipient.Text;
Organization.Caption := Msg.Organization;
Priority.Caption := IntToStr(Ord(Msg.Priority) + 1);
//Setup attachments list
ShowStatus('Decoding attachments (' + IntToStr(Msg.MessageParts.Count) + ')');
for intIndex := 0 to Pred(Msg.MessageParts.Count) do
begin
if (Msg.MessageParts.Items[intIndex] is TIdAttachmentFile) then
begin //general attachment
pnlAttachments.visible := true;
li := lvMessageParts.Items.Add;
li.ImageIndex := 8;
li.Caption := TIdAttachmentFile(Msg.MessageParts.Items[intIndex]).Filename;
li.SubItems.Add(TIdAttachmentFile(Msg.MessageParts.Items[intIndex]).ContentType);
end
else
begin //body text
if Msg.MessageParts.Items[intIndex] is TIdText then
begin
Memo1.Lines.Clear;
Memo1.Lines.AddStrings(TIdText(Msg.MessageParts.Items[intIndex]).Body);
end
end;
end;
//ShowStatus(stTemp);
//Showbusy(false);
end;
end;