Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel certificate verification errors when sending TLS email

Windows 10, Apache httpd 2.4, PHP 7.1.4, Laravel 5.5
Gmail's less secure is Allowed.


My .env file:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl

Error Message:

Connection could not be established with host smtp.gmail.com


MAIL_PORT=587
MAIL_ENCRYPTION=tls

Error Message:

stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed

How can I resolve the "certificate verify failed" error?

like image 620
ronrun Avatar asked Dec 13 '25 18:12

ronrun


1 Answers

If your operating system doesn't automatically manage your trusted certificate store:

  1. Download the cURL cacert.pem certificate bundle

  2. Put the cacert.pem bundle somewhere you like; if you have self-signed certificates that need to be accepted, open the bundle in a text editor and add them to the end of the file.

  3. Edit php.ini to reference this file location:

curl.cainfo = D:/Servers/php/sslfiles/cacert.pem
openssl.cafile = D:/Servers/php/sslfiles/cacert.pem
  1. Restart PHP-FPM or your web server, depending on how you are running PHP.
like image 167
ronrun Avatar answered Dec 16 '25 09:12

ronrun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!