When trying to send mail via PHPMailer, the following error is returned:
Peer certificate CN=`hostname' did not match expected CN=`remote.domain'
PHP Mail() also will not function as expected.
Description
This error states that the SSL verification failed for the address PHP tried to send mail to.
By default, cPanel servers restrict the ability of scripts on the server from sending mail. This is to prevent potential abuse but can make some scripts malfunction if they aren't sending mail via the system when using PHP handlers other than CGI.
This can also happen for invalid or mismatched certificates.
Workaround
Restrict SMTP Tweak
Log into WHM.
Navigate to "Tweak Settings"
Search "FKA"
Disable "Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak)" and save your changes
SSL to IP
If you try to connect to an IP address rather than a domain, SSL will fail to verify. Please use a fully qualified domain name for your SMTP server.
Comments
0 comments
Article is closed for comments.