Stream_socket_enable_crypto(): SSL operation failed with code in zend-mail

Warning : stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in D:\XAMPP\htdocs\sn\zend-mail\vendor\zendframework\zend-mail\src\Protocol\Smtp.php on line 215

Fatal error : Uncaught Zend\Mail\Protocol\Exception\RuntimeException: Unable to connect via TLS in D:\XAMPP\htdocs\sn\zend-mail\vendor\zendframework\zend-mail\src\Protocol\Smtp.php:216 Stack trace: #0 D:\XAMPP\htdocs\sn\zend-mail\vendor\zendframework\zend-mail\src\Transport\Smtp.php(401): Zend\Mail\Protocol\Smtp->helo(ā€˜localhostā€™) #1 D:\XAMPP\htdocs\sn\zend-mail\vendor\zendframework\zend-mail\src\Transport\Smtp.php(383): Zend\Mail\Transport\Smtp->connect() #2 D:\XAMPP\htdocs\sn\zend-mail\vendor\zendframework\zend-mail\src\Transport\Smtp.php(394): Zend\Mail\Transport\Smtp->lazyLoadConnection() #3 D:\XAMPP\htdocs\sn\zend-mail\vendor\zendframework\zend-mail\src\Transport\Smtp.php(251): Zend\Mail\Transport\Smtp->connect() #4 D:\XAMPP\htdocs\sn\zend-mail\api-sender.php(29): Zend\Mail\Transport\Smtp->send(Object(Zend\Mail\Message)) #5 {main} thrown in D:\XAMPP\htdocs\sn\zend-mail\vendor\zendframework\zend-mail\src\Protocol\Smtp.php on line 216

Every time I encounter this type of error, I normally can fix it with with the following steps.

  1. There are no root certificates (CA) installed. You might try the steps mentioned here -> https://neurotechnics.com/blog/ssl-ca-bundles-for-curl-and-php/ and make PHP aware by adding the .pem file to your php.ini file by changing the line, starting with ā€œopenssl.cafile=ā€ and add the path and file-name to it.
  2. You might be behind a corporate proxy/firewall that inserts its own certificate. In that case you have to add the public key to the cert file mentioned in step1.

I hope that gets you back on track.

2 Likes