I am getting the following warning when trying to configure and send mail using PHPMailer:
PHP Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
I have looked around at the other solutions, and none of them work. Here are some particulars:
My cert (from letsencrypt) is valid, at least in my Nginx config. My WordPress site serves securely with no errors. My PHP version is 7.0.xx
I have tried adding the cert file location to
php.ini
, but it warns of a failure to load stream, even though the address is correct. Here is what I have tried (among others):openssl.capath = "/etc/letsencrypt/live/example.org/"
This results in exactly the same error as above.I have also tried:
openssl.cafile = "/etc/letsencrypt/live/example.org/fullchain.pem"
but get warning:PHP Warning:failed loading cafile stream
My PHP mailer config (that is inside my wordpress functions file) looks like this:
$phpmailer->Host = 'mail.example.org';
$phpmailer->SMTPAuth = true;
$phpmailer->Port = 587;
$phpmailer->Username = 'myadminaccount@example.org';
$phpmailer->Password = 'mypassword';
$phpmailer->SMTPSecure = "tls";
$phpmailer->From = "myadminaccount@example.org";
$phpmailer->FromName = "MY Admin Account";
As I said, I have tried the various solutions elsewhere on the site, and none of them work. And I am baffled because my local cert (and the cert of the mail server for that matter) are both valid.
I don't really want to turn off peer verification as suggested elsewhere, but if I have to I guess I will.