以下就是显示outlook邮件内容程序,
正文文本显示为:This is a multi-part message in MIME format.不是原文内容.
附件列表中总是多显示两个图标,没有附件,也会显示这两个图标,怎么回事呢?
procedure TForm1.ButtonplayClick(Sender: TObject);
var
intIndex: Integer;
li: TListItem;
begin
if lvHeaders.Selected = nil then
begin
Exit;
end;
Msg.Clear;
Memo1.Clear;
lvMessageParts.Items.Clear;
POP.Retrieve(lvHeaders.Selected.Index + 1, Msg); //get message and put into MSG
//Setup attachments list
for intIndex := 0 to Pred(Msg.MessageParts.Count) do
begin
if (Msg.MessageParts.Items[intIndex] is TIdAttachment) then
begin
li := lvMessageParts.Items.Add;
li.ImageIndex := 8;
li.Caption := checktxt(TIdAttachment(Msg.MessageParts.Items[intIndex]).Filename);
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;
end;