unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Psock, NMsmtp;
type
TForm1 = class(TForm)
NMSMTP1: TNMSMTP;
Label1: TLabel;
host: TEdit;
L_userid: TLabel;
userid: TEdit;
Label2: TLabel;
password: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure NMSMTP1ConnectionFailed(Sender: TObject);
procedure NMSMTP1Success(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
NMSMTP1.Host:=host.Text;
NMSMTP1.UserID:=userid.Text;
NMSMTP1.Port:=25;
NMSMTP1.Connect;
end;
procedure TForm1.NMSMTP1ConnectionFailed(Sender: TObject);
begin
showmessage('Fail!');
exit;
end;
procedure TForm1.NMSMTP1Success(Sender: TObject);
begin
showmessage('success');
end;
end.
现在只是测试连接部分