When trying to send mail via PHPMailer, the following error is returned:
Peer certificate CN=`hostname' did not match expected CN=`remote.domain'
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.
Log into WHM.
Navigate to "Tweak Settings"
Disable "Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak)" and save your changes