delphi 调用QQ邮箱发送邮件

procedure TForm1.FormCreate(Sender: TObject);
begin
  try
    IdSMTP1.AuthenticationType := atLogin;
    IdSMTP1.Host := 'smtp.qq.com';
    IdSMTP1.Username := '[email protected]';        //qq邮箱
    IdSMTP1.Password := 'tjlhnnajvwrgbifca';  //授权码
    IdSMTP1.Port := 25;
    IdSMTP1.Connect(3000);
    IdSMTP1.Authenticate;

    IdMessage1.Subject := '测试邮件';
    IdMessage1.From.Address := '[email protected]';
    IdMessage1.Recipients.EMailAddresses := '[email protected]';
    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

 

猜你喜欢

转载自www.cnblogs.com/onlyou13/p/10546099.html