1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103:
| uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, IdMailBox, IdBaseComponent, IdNetworkCalculator, StdCtrls, ExtCtrls, IdMessage, IdSMTP, IdComponent, IdTCPConnection, IdTCPClient, IdMessageClient, IdPOP3, IdIntercept, IdLogBase, IdLogFile, IdMessageCoder, IdMessageCoderMIME, IdAntiFreezeBase, IdAntiFreeze, IdHTTP, ScktComp; type TForm2 = class(TForm) Label1: TLabel; ed_logfile: TButton; ed_beenden: TButton; IdPOP31: TIdPOP3; IdSMTP1: TIdSMTP; IdMessage1: TIdMessage; Bevel1: TBevel; Label2: TLabel; Label3: TLabel; Label4: TLabel; IdAntiFreeze1: TIdAntiFreeze; Timer1: TTimer; procedure ed_logfileClick(Sender: TObject); procedure ed_beendenClick(Sender: TObject); procedure IdPOP31Status(ASender: TObject; const AStatus: TIdStatus; const AStatusText: String); procedure IdSMTP1Status(ASender: TObject; const AStatus: TIdStatus; const AStatusText: String); procedure Timer1Timer(Sender: TObject); private public end;
var Form2: TForm2;
implementation
uses Unit1, Unit3;
{$R *.DFM}
procedure TForm2.ed_logfileClick(Sender: TObject); begin Form3.Show; end;
procedure TForm2.ed_beendenClick(Sender: TObject); begin IdPOP31.Disconnect; IdSMTP1.Disconnect; Form3.Memo1.Lines.Add(DateToStr(Now)+' '+TimeToStr(NOW)+' '+'Anwendung beendet'); Form3.Memo1.Lines.Add(''); Form3.Memo1.Lines.SaveToFile('logfile.txt'); Form1.Close; end;
procedure TForm2.IdPOP31Status(ASender: TObject; const AStatus: TIdStatus; const AStatusText: String); begin Label4.Caption:=AStatusText; Form3.Memo1.Lines.Add(DateToStr(Now)+' '+TimeToStr(NOW)+' '+'pop3 - Status: '+AStatusText+''); Form3.Memo1.Lines.Add(''); Form3.Memo1.Lines.SaveToFile('logfile.txt'); end;
procedure TForm2.IdSMTP1Status(ASender: TObject; const AStatus: TIdStatus; const AStatusText: String); begin Label4.Caption:=AStatusText; Form3.Memo1.Lines.Add(DateToStr(Now)+' '+TimeToStr(NOW)+' '+'SMTP - Status: '+AStatusText+''); Form3.Memo1.Lines.Add(''); Form3.Memo1.Lines.SaveToFile('logfile.txt'); end;
procedure TForm2.Timer1Timer(Sender: TObject); var i:integer; begin IdPOP31.Disconnect; IdPOP31.Connect; Label3.Caption:=IntToStr(Form2.IdPOP31.CheckMessages);
Form3.Memo1.Lines.Add(DateToStr(Now)+' '+TimeToStr(NOW)+' '+'Neue Mails: '+IntToStr(Form2.IdPOP31.CheckMessages)+''); Form3.Memo1.Lines.Add(''); Form3.Memo1.Lines.SaveToFile('logfile.txt');
for i:=0 to IdPOP31.CheckMessages do begin IdPOP31.Retrieve(i, IdMessage1); IdSMTP1.Connect; try IdSMTP1.Send(IdMessage1); finally IdSMTP1.Disconnect; end; end; end; |