procedure TForm1.Button1Click(Sender: TObject);
begin
nmsmtp1.Host :='202.107.117.252';
if nmsmtp1.Connected then
begin
nmsmtp1.PostMessage.FromAddress:= edit1.Text ;
nmsmtp1.PostMessage.ToAddress.Text :=edit3.Text ;
nmsmtp1.PostMessage.Subject:=edit4.Text ;
nmsmtp1.PostMessage.Body.Text :=memo1.Text ;
NMSMTP1.PostMessage.Attachments.Add('c:/pdos.def');//在这里指定你要发的文件
nmsmtp1.SendMail ;
end
else
begin
nmsmtp1.Connect ;
nmsmtp1.PostMessage.FromAddress:= edit1.Text ;
nmsmtp1.PostMessage.ToAddress.Text :=edit3.Text ;
nmsmtp1.PostMessage.Subject:=edit4.Text ;
nmsmtp1.PostMessage.Body.Text :=memo1.Text ;
NMSMTP1.PostMessage.Attachments..Add('c:/pdos.def');//在这里指定你要发的文件
nmsmtp1.SendMail ;
end;
end;
有问题请来信:sunyl@dongyubooks.com
Good Lucky !!!!!!