delphirules
delphirules

Reputation: 7388

TIdSMTP : How to fix the error SSL negotiation Failed

I've been using Indy to send emails for ages and it always worked well. Currently I'm using Delphi 10.4, with the Indy version that comes with it.

Today when I tried to use a specific server, even with everything setup as usual, I'm getting these exceptions:

Project myproject.exe raised Exception class EIdOSSLUnderlyingCryptoError with message 'Error connecting with SSL. error 1409442E:SSL routines:SSL3_READ_BYTES:tslv1 alert protocol version

And right after :

Project myproject.exe raised Exception EIdTLSClientTLSHandShakeFailed with message : 'SSL negotiation failed'

The port is 587 and so far, I've been using the sslvTLSv1 method on TIdSSLIOHandlerSocketOpenSSL.SSLOptions.Method.

What should I try to get the sending work, using this specific server?

Upvotes: 2

Views: 8579

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 596307

Most likely, the server in question does not allow TLS 1.0, which is the only version you are enabling. You should be using the IOHandler's SSLOptions.SSLVersions property instead of its SSLOptions.Method property, and then set SSLVersions to [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2] so the client may negotiate use of TLS 1.0, 1.1, or 1.2 depending on which one the server allows.

Upvotes: 5

Related Questions