I am using the TIdSMTP but when I try to send mail I get an error message such as: "530 Must issue a STARTTLS command first"
|Previous Top Next|
This message means that the SMTP server requires you to use TLS when authenticating and sending E-Mail. The server expects you to use explicit TLS SMTP. For this, you connect to port 25, issue an EHLO command and get a reply, send a STARTTLS command, and after getting a success reply, you then negotiate TLS with the server.
For Indy 8 and 9
Indy 8 and Indy 9 do not support explicit TLS with SMTP. If the SMTP server supports implicit TLS with SMTP, you may able to use implicit TLS with SMTP by stting the TIdSMTP.IOHandler to TIdSSLIOHandlerSocket and the port to the IdPORT_ssmtp constant in IdAssignedNumbers (465).
For Indy 10
Indy 10 supports SMTP with explicit TLS. In the Indy 10's TIdSMTP, you simply have to assign a TIdSSLIOHandlerSocketBase descendent to the TIdSMTP.IOHandler property and set the UseTLS property to either utUseRequireTLS if you do not want to use an unencrypted connection or utUseExplicitTLS if you are willing to use an unencrypted connection.