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
相關文章
相關標籤/搜索