I AM LISTENING TO
|

WHAT I LIKE

First steps to Install a Comodo SSL certificate Fixing WordPress + Chrome 45+ admin menu glitch
Development     Hosting     PHP     WordPress    

PHP 5.6 + phpMailer + WordPress + Connection Errors



9. September 2015

Since version 5.6PHP is verifying peer certificates and host names by default when using SSL/TLS. This is causing problems on some servers / websites, where the config has not been setup correctly. If you can not fix the setup yourself, make sure to talk to your server host to fix that issue.

For PHPMailer (Github) there is a workaround:

This should only be a workaround until your configuration has been fixed. You are suppressing certificate verification and compromising your security!

As WordPress is using PHPMailer as its main email library, this can be tweaked by using the phpmailer_init hook:

Add this to your themes functions.php.

BASIC PHPMAILER SETUP

And here is how phpmailer->smtpOptions should be used,  on a properly configured server:

SSL changes in PHP 5.6: http://php.net/manual/en/migration56.openssl.php
SSL context options in PHP: http://php.net/manual/en/context.ssl.php

Enjoy coding…




Leave a Reply

4 Comments on "PHP 5.6 + phpMailer + WordPress + Connection Errors"

Notify of
avatar
Sort by:   newest | oldest | most voted
Michael Rimbach
Guest
Michael Rimbach

You code is not correct, one “->” is to mutch 🙂
$phpmailer->->SMTPOptions should be $phpmailer->SMTPOptions

Itamar Megged
Guest
Itamar Megged

thanks a lot, finally a good and full explanation for WP!

wpDiscuz