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
MAIL_USERNAME=account@gmail.com
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?
I found the solution. No need to change guzzlehttp/guzzle/src/Client.php which is suggested in another question.
Solution:
Download cacert.pem file from https://curl.haxx.se/docs/caextract.html
Put the cacert.pem somewhere you like.
Edit php.ini
two lines:
curl.cainfo=D:/Servers/php/sslfiles/cacert.pem
openssl.cafile=D:/Servers/php/sslfiles/cacert.pem
When you receive ssl certificate verification error, You can set these two variables in.env file:
MAIL_PORT=587
MAIL_ENCRYPTION=tcp
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.