📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdMessageClient, IdPOP3, ExtCtrls, StdCtrls,shellapi,mmsystem;
type
TForm1 = class(TForm)
Button1: TButton;
Timer1: TTimer;
IdPOP31: TIdPOP3;
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
i,FMsgCount:integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if IdPOP31.Connected then
begin
IdPOP31.Disconnect;
end;
edit4.text:='';
IdPOP31.Host := edit1.text;
IdPOP31.Username := edit2.text;
IdPOP31.Password := edit3.text;
label4.caption:='开始查询邮箱';
IdPOP31.Connect;
FMsgCount := IdPOP31.CheckMessages;
i:=FMsgCount;
if FMsgCount > 0 then
begin
label4.caption:='邮箱中没有新邮件...';
end
else
begin
Showmessage('No messages on server');
end;
IdPOP31.disConnect;
timer1.Enabled:=true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
IdPOP31.Connect;
if (IdPOP31.CheckMessages>FMsgCount) then
BEGIN
PlaySound ('newemail.wav', 0, snd_async);
label4.caption:='有新邮件...';
FMsgCount:=IdPOP31.CheckMessages;
edit4.Text:=inttostr(FMsgCount-i);
END;
IDPOP31.DisConnect;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -