- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi通过IdSmtp发送邮件的简单代码
var
smtp: TIdSMTP;
MgeSend: TIdMessage;
procedure TForm1.Button1Click(Sender: TObject);
begin
SMTP.Host:='smtp.163.com';
smtp.Username:='xxxx@163.com';
smtp.Password:='paswrd';
smtp.Port:=25;
smtp.Connect();
MgeSend.Recipients.EMailAddresses:='xxxx@qq.com';
MgeSend.From.Text :='xxxx@163.com';
MgeSend.Subject:='test';
MgeSend.Body.Text:='发邮件测试';
SMTP.Authenticate;
Smtp.Send(mgeSend);
end;