PHPMailer script or any CMS that uses it can not sent messages

Created:

2017-06-29 09:46:36 UTC

Modified:

2017-08-08 13:08:52 UTC

0

Was this article helpful?


Have more questions?

Submit a request

PHPMailer script or any CMS that uses it can not sent messages

Symptoms

Cannot configure SMTP server in Joomla:

PLESK_ERROR: SMTP Error: Could not connect to SMTP host.

The following error can be found in domain error_log:

# mod_fcgid: stderr: Connection failed. Error #2: stream_socket_enable_crypto(): Peer certificate CN=`example.com' did not match expected CN=`somedomain.tld'

 

Cause

Starting from PHP 5.6 stream wrapper now verify peer certificates and host names by default when using SSL/TLS. What does it mean:

  • Connection will fail in case you use self-signed certificate
  • Or in case your certificate for mail is not the same as your domain name connection will fail too.

Resolution

There are two options to solve this:

1. Secure mail using Let's Encrypt and instructions from KB #115000179934 and use everywhere domain name you used to secure mail in most cases hosting providers use hostname of the server fro that.
2. In case you would like each domain owner to be able to specify their domain name, create multi-domain certificate and install it manually using #213924425 , in that case you would be able to connect using any domain name from the certificate.

 

Have more questions? Submit a request
Please sign in to leave a comment.