Plesk for Linux
kb: technical
ext: migrator
ABT: Group B
Applicable to:
- Plesk for Linux
Symptoms
- It is not possible to configure SMTP server in Joomla:
PLESK_ERROR: SMTP Error: Could not connect to SMTP host.
- The following error can be found in domain
/var/www/vhosts/system/example.com/logs/error_log:
CONFIG_TEXT: mod_fcgid: stderr: Connection failed. Error #2: stream_socket_enable_crypto(): Peer certificate CN=`example.com' did not match expected CN=`hostname.com'
Cause
Starting from PHP 5.6 stream wrapper now verify peer certificates and hostname by default when using SSL/TLS. It means that:
- Connection will fail in case if self-signed certificate is used;
- In case when the certificate for mail is not the same as the domain name, connection will fail too.
Resolution
Secure mail server using Let's Encrypt certificate. To install it, use the following article: How to secure mail server with Let's Encrypt certificate.
Comments
1 comment
This answer needs far more explanation.
The issue is that connecting with PHPMailer from a Let's Encrypt hosted domain (MyHostedDomain.com) ends up seeming to conflict with the certificate from the server's overall Let's Encrypt certificate (MyServer.com).
In the script,
end's up getting routed to 'MyServer.com' and throwing the certificate conflict. Saying, unsurprisingly, that 'MyHostdDomain.com' doesn't match 'MyServer.com'.
If there's some way that hosted domains are supposed to connect to a Plesk SMTP mail system, specific details should be included in the answer. In fact since this question is about PHPMailer, the answer should ideally show PHPMailer code example (as it's the most widely used PHP mailing package.)
The only way I've been able to connect is to overwrite the SSL options using:
Please sign in to leave a comment.