骷
骷髅头
Unregistered / Unconfirmed
GUEST, unregistred user!
代码:
procedure TForm1.Button1Click(Sender: TObject);beginSMTP1.AuthenticationType := atLogin;SMTP1.username:= edit2.text;SMTP1.Password := edit1.text; // smtp1.username:='testname'; //smtp1.password:='testPassWord' ;SMTP1.Host := edit3.text;//SMTP1.host:='smtp.126.com';//改成 SMTP1.host:='smtp.qiye.163.com'SMTP1.Port :=25; try SMTP1.Connect; except Showmessage('连接SMTP服务器失败!'); Exit; end; try with IdMsg do begin body.Clear; Body.Assign(memo1.lines); From.address := edit5.text; Recipients.EMailAddresses :=edit6.text; Subject:=edit4.text; Priority:=TIdMessagePriority(1); //身份验证类型 end; SMTP1.Authenticate; SMTP1.Send(IdMsg); // SMTP1.Disconnect; finally showmessage('您的信件已成功发送'); SMTP1.Disconnect; end;end;