procedure TForm1.BtnPOPClick(Sender: TObject);
var
i: Integer;
begin
try
BtnPOP.Enabled := False;
ClosePOP.Enabled := True;
with ServerPOP3do
begin
SBar.SimpleText := '正在接收邮件......';
Application.ProcessMessages;
AttachFilePath := 'D:/temp';
DeleteOnRead := FALSE;
ReportLevel := Status_Basic;
TimeOut := 20000;
Host := POPEdit.Text;
Port := 110;
UserID := UserIDEdit.text;
Password := PAsswordEdit.text;
Connect;
Label3.caption := '已接收信件列表:'+IntToStr(MailCount);
GridList.RowCount := MailCount + 1;
if GridList.Rowcount < 2 then
GridList.RowCount := 2;
GridList.Cells[0,0] := '发件人地址';
GridList.Cells[1,0] := '主题';
for i := 1 to MailCountdo
begin
GetMailMessage(i);
// GetSummary(i);
GridList.Cells[0,i] := MailMessage.From;
GridList.Cells[1,i] := MailMessage.Subject;
// GridList.Cells[0,i] := Summary.From;
// GridList.Cells[1,i] := Summary.Subject;
end;
// DisConnect;
end;
finally
SBar.SimpleText := '接收邮件完毕 '+IntToStr(ServerPOP3.BytesRecvd)+
' 字节 '+IntToStr(ServerPOP3.BytesTotal)+' 接收';
Application.ProcessMessages;
// BtnPOP.Enabled := True;
end;
end;