Vojtěch Šalda
Vojtěch Šalda

Reputation: 85

CakePHP 3 SMTP TLS configuration

I have a problem with connecting to email server through SMTP with encryption (ssl with tls). It is Kerio Connect service where the connection worked for years and suddenly stopped after update. I tried both ports 25 and 465. I tried ssl both with tls and without but nothing worked for me. Certificate is correct and everything worked a few hours ago. I have no idea what else to try. The error messages I get are:

error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

EDIT: Maybe it could be the version of TLS but I did not find any option to force TLS1.2 to check if it helps.

Upvotes: 0

Views: 528

Answers (1)

Zordon
Zordon

Reputation: 171

In my case to force TLS 1.2 with CakePHP 3.3, I fixed the issue by editing the following file:

app/vendor/cakephp/cakephp/src/Network/Socket.php line 91

Replace STREAM_CRYPTO_METHOD_TLS_CLIENT with STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT

You must be using at least php 5.6 and openssl 1.0.1. I hope this helps.

Upvotes: 0

Related Questions