I was Configuring WP Mail SMTP Plugin for WordPress on client site. Default PHP mail function works well, but a couple of users reported mail getting delivered in the SPAM folder. So we decided to route mailing one of the Official ID using SMTP.
We installed Plugin, Configured credentials. The task was like 10 min work, and the test mail was a failure. We had SMTP connect() failed Error in Debug Log. Found out it was a misconfiguration at the Server based on following Quotes found on Forums.
“Note that the default value of SSLProxyCheckPeerCN is off in httpd 2.2.x and on in httpd 2.4.x. Note that SSLProxyCheckPeerExpire and SSLProxyCheckPeerName also now default to on in 2.4.”
check SSL module mod_ssl.so is loaded in httpd.conf
Everything was just fine in httpd.conf which is auto-generated in Cpanel/WHM. So on searching Cpanel Support Forum Found out, there’s Hardening Setting in WHM > SMTP Restriction. So if you are stuck with it, make sure to disable it. SMTP will work like Charm.