Reputation: 1
I am working locally on xampp
and using Gmail SMTP plugin
to get my contact form 7 to work. When I try sending a test email it fails, and i get this error message:
Connection failed. Error #2: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed [C:\xampp1\htdocs\WP\wp-content\plugins\gmail-smtp\PHPMailer\class.smtp.php line 369]
SMTP Error: Could not connect to SMTP host.
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
I changed the mail function settings in php.ini
and sendmail
configuration accordingly. Can you help me with what the problem might be here?
Upvotes: 0
Views: 391
Reputation: 11
Here is my smtp client for sending email from php with ssl socket https://github.com/breakermind/PhpMimeParser/blob/master/PhpSmtpSslSocketClient.php you can test with php And here with php mailer example https://github.com/fxstar/PhpJsCss/blob/master/SMTPmail/send-phpmailer-smtp-ssl.php Or here another example https://github.com/fxstar/PhpJsCss/blob/master/MailerPHP/smtp.php
Upvotes: 0
Reputation: 468
You are getting this error most likely because internally, PHPMailer is trying to establish a secure connection (SSL/HTTPS) and the SSL certificate verification is failing because it is most like a self-signed certificate
(inside xampp just for development).
Try allowing insecure connections (without SSL encryption - at least during development) by using the suggested piece of code
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
As the document itself recommends against making these configurations globally in the php.ini file, you may want to revert them. And use the Run-time options instead (the code above).
Upvotes: 1