我想用 INDY 10 / DELPHI 删除带有特定标头或特定发件人的邮件。我已经可以使用 INDY10 查询我的电子邮件帐户。这是现有的演示代码:
procedure TForm1.BtnCheckClick(Sender: TObject);
var
i: Integer;
Msg: TIdMessage;
MailCount: Integer;
begin
if IdPop31.Connected then
begin
MailCount := IdPOP31.CheckMessages;
lbMailCount.Caption := IntToStr(MailCount);
lbMailboxSize.Caption := IntToStr(IdPOP31.RetrieveMailBoxSize) + ' Bytes';
for i := 1 to MailCount do
begin
Msg := TIdMessage.Create;
try
IdPOP31.RetrieveHeader(i, Msg);
MailsList.Lines.Add(Msg.Subject + ' from ' + Msg.From.Text);
finally
Msg.Free;
end;
end;
end;
end;