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;