Error when trying to authenticate through smtp

edited February 2017 in Email

I have some forms to authenticate through smtp:

They were working but now getting an error. I think maybe a firewall issue?

Warning: stream_socket_enable_crypto(): Peer certificate' did not match expected' in /home/sitename/public_html/wp-includes/class-smtp.php on line 344


  • edited February 2017


    That error is indicating that a certificate with the name' was expected, but a certificate with a name ` was used or received. This issue would have to be resolved in the site code by a developer. Please let us know if there is anything else that we can assist with.

  • I understand but I think this is something to do with a setting on whm as it was working and now it is not for all sites:

    It seems to timeout: 2016-05-18 19:23:00 Connection: opening to ssl://, timeout=300, options=array ( )

  • Hi,

    You need to configure your scripts that are connecting to SMTP to connect using the common name of the certificate that is in use on According to the error message, that means you need to connect to "" instead of ""

    Please let me know if you have any other questions.

  • I have put it back to but when I try and connect to I get an instant timeout. When I run this script on another server, it works fine.

    I am trying to tracert but it says the command is not found although active on whm. Do I need to reboot server?

  • Hi,

    What port is your script trying to connect out on?

  • Right now I have it on: 465

  • Could port 465 not be blocked in your firewall?

  • Thanks that worked. How and when did this start getting blocked?

  • It may have been closed since CSF was initially installed. If you manually whitelisted the IP that, that would have worked around the actual port being blocked.

    465 is a very common port for outgoing SMTP with SSL, so it is better to just open up the port. There is no security risk in doing so.

This discussion has been closed.