Symptoms
- WP-Mail-SMTP plugin is installed on WordPress site.
- It's not possible to send a test email WP Admin > Settings > Email > Send test:
Warning: stream_socket_enable_crypto(): Peer certificate CN=`server.hostname.com' did not match expected CN=`localhost' in C:Inetpubvhostsexample.comhttpdocswp-includesclass-smtp.php on line 369
...
SMTP ERROR: Failed to connect to server: (0)SMTP connect() failed - Plugin is configured to use port 587 or 465: WP Admin > Settings > Email > SMTP Port
Cause
Incorrect SMTP Host is specified in plugin.
Resolution
Use server hostname(server.hostname.com) in WP Admin > Settings > Email > SMTP Host instead of localhost.
Hostname can be found at Plesk > Home page or in MailEnable > Services > localhost > Services and Connectors > SMTP Properties > General > Local domain name
Note: Mail server must be secured by SSL certificate .