chmichael 12 Posted April 26, 2020 Hello, Any ideas why the below code does not send the email: (it doesn't through an exception either) var vSMTP: TSmtpCli; begin vSMTP := TSmtpCli.Create(nil); with vSMTP do begin Host := 'my.mailhost.com'; Username := 'user@mailhost.com'; Password := 'password'; OwnHeaders := True; ContentType := smtpPlainText; CharSet := 'UTF-8'; HdrFrom := 'user@mailhost.com'; HdrTo := 'user@mailhost.com'; HdrSubject := UTF8Encode('Subject'); MailMessage.Text := UTF8Encode('Body'); Connect; while State <> smtpReady do begin ProcessMessages; Sleep(50); end; Mail; FreeAndNil(vSMTP); end; end; Thank you Share this post Link to post
FPiette 383 Posted April 26, 2020 Calling connect is not enough to send a mail. See the sample program, seen the code behind "all in one" button. Share this post Link to post