Smtp Problem

hi i am having a problem can help you all the settings looks normal but tls can’t activate

ErrorException: Email to em*****@gmail.com failed: [E_WARNING] stream_socket_enable_crypto(): Peer certificate CN=host.cleared.com' did not match expected CN=cleared’

Problem Solved

/etc/dovecot/dovecot.conf

Added

auth_mechanisms = plain login

Phpmailer

Changed Server IP to Server Host Name

$mail->Host = “hostname”;

Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /home/XXXXXup.com/public_html/W3MAILBOX/YYYY/lib/class.smtp.php on line 368

Fatal error: Uncaught phpmailerException: SMTP Error: Could not connect to SMTP host. in /home/XXXXXup.com/public_html/W3MAILBOX/YYYY/lib/class.phpmailer.php:1678

Is anyone also facing the issue?