delphi 调用QQ邮箱发送邮件

     阅读 186 次    更新时间:2024/1/25    

delphi 调用QQ邮箱发送邮件

 

procedure TForm1.FormCreate(Sender: TObject);
begin
  try
    IdSMTP1.AuthenticationType := atLogin;
    IdSMTP1.Host := 'smtp.qq.com';
    IdSMTP1.Username := 'test@qq.com';        //qq邮箱
    IdSMTP1.Password := 'tjlhnnajvwrgbifca' //授权码
    IdSMTP1.Port := 25;
    IdSMTP1.Connect(3000);
    IdSMTP1.Authenticate;
 
    IdMessage1.Subject := '测试邮件';
    IdMessage1.From.Address := 'test@qq.com';
    IdMessage1.Recipients.EMailAddresses := 'test@foxmail.com';
    IdMessage1.Body.Text := 'hello kkkkkkkkkkkkkk';
 
    IdSMTP1.Send(IdMessage1);
  except
    on e: Exception do
    ShowMessage(e.Message);
  end;
end;
 
win10 + delphi 7测试ok,不用管SSL。本文发表于2019-03-17 11:45:08
 
 

Copyright 2003-2008 All Rights Reserved 自由风工作室 版权没有 [湘ICP备06002185号]
.