When trying to send emails through smtp.google.com
via PHPMailer on PHP hosted by IIS on Windows 10, I get this error message:
Connection failed
To paraphrase the guide, download the CA bundle from curl and store it somewhere on your file system. Take the path you saved it to and add a line to your php.ini file saying:
openssl.cafile = $path
Where $path is where you saved the CA certs to. Then restart your web server to pick up the ini change.
If that worked, you should see that setting in the output from phpinfo()
, and it should also give PHP what it needs to validate the certificate when PHPMailer uses it. Be aware that if the server is presenting a truly invalid or expired certificate, this won’t help, but given that this a well-known problem and solution, I expect it to work.