Peer certificate CN=`your.server.com’ did not match expected CN=`smtp.office365.com’ (WHM/cPanel issue)

Problem: When you configure a script to use an external SMTP server, you get an error message that the certificate on your server doesn’t match the one on the remote SMTP server.

Solution: The issue is that cPanel has changed its security settings and now disables remote connections to SMTP servers by default in order to help combat abuse (eg. if your website gets hacked the hackers cannot use it to send spam through a 3rd party SMTP server). The way it does this is by looping back all outgoing SMTP connection attempts back to itself. Since your server is not in fact the server you are trying to connect to, you get an error similar to the one above about the certificates not matching. If it’s your own server the solution is relatively simple. Log into your WHM control panel, and select

Read more