Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Peer certificate did not match expected

Discussion in 'Security' started by Patrik, Nov 1, 2017.

  1. Patrik

    Patrik Member

    Joined:
    Aug 25, 2017
    Messages:
    18
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Sweden
    cPanel Access Level:
    Root Administrator
    A customer on my server is trying to send email from his website to his email account. For this he's using PHPMailer 6.

    Here is the error message he's getting:
    Code:
    2017-10-31 14:26:21 Connection failed. Error #2: stream_socket_enable_crypto(): Peer certificate CN=`<hostname>' did not match expected CN=`smtp.gmail.com' [/home/[CUSTOMER]/public_html/vendor/phpmailer/phpmailer/src/SMTP.php line 404]
    
    SMTP Error: Could not connect to SMTP host.
    
    I think this has to do with the certificate either not being installed properly, or the certificate is seen as self-signed, neither of which should be true. Going to <hostname>:2087 shows a secured and working cPanel with a valid cert.

    He apparently also tried installing WordPress and Gmail SMTP and generated new keys, in order to verify that his implementation of xoauth2 was correct. Same error messages.
    In order to get it to work at all, he has to bypass SSL certificate validation, which is obviously not a good thing to do. It doesn't help that the documentation on this says "this is implemented for good reason, get your host to fix the configuration."
     
    #1 Patrik, Nov 1, 2017
    Last edited by a moderator: Nov 1, 2017
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,442
    Likes Received:
    1,962
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    A similiar error message is referenced on the following thread:

    Issue sending mails through 3rd party

    In that case, the solution was to disable "WHM >> SMTP Restrictions". Can you check if that helps in this case?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. dr1ss

    dr1ss Registered

    Joined:
    Nov 2, 2017
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Morocco
    cPanel Access Level:
    Root Administrator
    Had the same problem, disabling SMTP restrictions fixed the issue.
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice