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;