Cannot connect to GMail SMTP (PHPMailer) - Certificate Verify Failed

后端 未结 1 1018
一整个雨季
一整个雨季 2020-12-07 05:44

Very recently encountered this error when trying to send mail via SMTP and GMail.

Warning: stream_socket_enable_crypto(): SSL operation failed with code 1.
O         


        
相关标签:
1条回答
  • 2020-12-07 06:18

    FIXED ISSUE FOR ME I fixed this issue in my windows php environment by downloading an updated root certificates file and pointing my php.ini file to it. It seems the problem was not with gmail's cert but rather with an outdated root certificate file due to windows server 2012 no longer updating this file automatically. Download cacert.pem from here: https://curl.haxx.se/docs/caextract.html. Then in php.ini use following line to point to it (assuming you have openssl.dll installed).

    openssl.cafile={Path to the file on your server}\cacert.pem.

    That fixed it and I no longer needed to bypass SSL/TLS verification like suggested. Ultimately I need to get windows to update root certs automatically using GPO or WSUS. see https://serverfault.com/questions/541922/where-to-get-root-ca-certificates-for-windows-server-now-that-microsoft-no-longe

    0 讨论(0)
提交回复
热议问题