• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

SMTP Error - stream_socket_enable_crypto(): Peer certificate CN did not match expected CN

Slavik

XenForo moderator
Staff member
#1
Posting this up for reference to be found easily.

A lot of people upgrading to PHP 5.6+ are running into the following error:

ErrorException: Email to [email address] failed: stream_socket_enable_crypto(): Peer certificate CN=`[hostname]' did not match expected CN=`[target hostname]' - library/Zend/Mail/Protocol/Smtp.php:206

As of PHP 5.6 peer verification is enabled by default (http://php.net/manual/en/migration56.openssl.php).

If you are running WHM or Plesk, I found the issue could be resolved as follows:

WHM: Change the “Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak)” from “On” to “Off”.

Plesk: Create a new subscription with the URL set as the server host address, then assign it a SSL cert via the lets encrypt plugin.