Zen Cart Logo
Forums / General Questions / Failed sending email -- SMTP connect() failed - Peer certificate did not match

Failed sending email -- SMTP connect() failed - Peer certificate did not match

Views: 3,402

Results 1 to 11 of 11
30 Dec 2016, 3:23 PM
#1
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

Failed sending email -- SMTP connect() failed - Peer certificate did not match

zc 154
php 5.6.24
mySQL 5.6.34

Updated PHPMailer files using ftp by dragging/dropping the set of files as a complete set.
Used the 12/29/2016 fileset

Pink error bar in header ADMIN: Tools: Send Email

Similar pink bar when updating customer order comments

Error ERROR: Failed sending email to: "IMA Customer" with subject: "email test" SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Success Notice: Email sent to: [email protected] (1)

myDEBUG-adm file contents

[30-Dec-2016 07:09:19 America/Los_Angeles] Request URI: /ADMINFOLDERNAME/mail.php?action=send_email_to_user, IP address: https://chainweavers.com
#1  stream_socket_enable_crypto() called at [/home/chainwea/public_html/includes/classes/vendors/PHPMailer/class.smtp.php:369]
#2  SMTP->startTLS() called at [/home/chainwea/public_html/includes/classes/vendors/PHPMailer/class.phpmailer.php:1677]
#3  PHPMailer->smtpConnect() called at [/home/chainwea/public_html/includes/classes/vendors/PHPMailer/class.phpmailer.php:1540]
#4  PHPMailer->smtpSend() called at [/home/chainwea/public_html/includes/classes/vendors/PHPMailer/class.phpmailer.php:1335]
#5  PHPMailer->postSend() called at [/home/chainwea/public_html/includes/classes/vendors/PHPMailer/class.phpmailer.php:1213]
#6  PHPMailer->send() called at [/home/chainwea/public_html/includes/functions/functions_email.php:348]
#7  zen_mail() called at [/home/chainwea/public_html/ADMINFOLDERNAME/mail.php:62]

[30-Dec-2016 07:09:19 America/Los_Angeles] PHP Warning:  stream_socket_enable_crypto(): Peer certificate CN=`*.tvsecure.com' did not match expected CN=`mail.chainweavers.com' in /home/chainwea/public_html/includes/classes/vendors/PHPMailer/class.smtp.php on line 369
[30-Dec-2016 07:09:19 America/Los_Angeles] Request URI: /ADMINFOLDERNAME/mail.php?action=send_email_to_user, IP address: MyIPaddress
#1  trigger_error() called at [/home/chainwea/public_html/includes/functions/functions_email.php:376]
#2  zen_mail() called at [/home/chainwea/public_html/ADMINFOLDERNAME/mail.php:62]

[30-Dec-2016 07:09:19 America/Los_Angeles] PHP Notice:  Email Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting<br /> in /home/chainwea/public_html/includes/functions/functions_email.php on line 376

Looks like there are other myDEBUG related to the checkout process and causing checkout to fail

30 Dec 2016, 3:32 PM
#2
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

Re: Failed sending email -- SMTP connect() failed - Peer certificate did not match

Here's the myDEBUG sample contents

[28-Dec-2016 08:16:17 America/Los_Angeles] Request URI: /index.php?main_page=checkout_process&action=confirm, IP address: http://cpanelIDvers.com
#1  stream_socket_enable_crypto() called at [/home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.smtp.php:369]
#2  SMTP->startTLS() called at [/home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.phpmailer.php:1635]
#3  PHPMailer->smtpConnect() called at [/home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.phpmailer.php:1498]
#4  PHPMailer->smtpSend() called at [/home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.phpmailer.php:1335]
#5  PHPMailer->postSend() called at [/home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.phpmailer.php:1213]
#6  PHPMailer->send() called at [/home/cpanelID/public_html/includes/functions/functions_email.php:348]
#7  zen_mail() called at [/home/cpanelID/public_html/includes/classes/order.php:1078]
#8  order->send_order_email() called at [/home/cpanelID/public_html/includes/modules/checkout_process.php:95]
#9  require(/home/cpanelID/public_html/includes/modules/checkout_process.php) called at [/home/cpanelID/public_html/includes/modules/pages/checkout_process/header_php.php:14]
#10 require(/home/cpanelID/public_html/includes/modules/pages/checkout_process/header_php.php) called at [/home/cpanelID/public_html/index.php:36]

[28-Dec-2016 08:16:17 America/Los_Angeles] PHP Warning:  stream_socket_enable_crypto(): Peer certificate CN=`*.tvsecure.com' did not match expected CN=`mail.cpanelIDvers.com' in /home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.smtp.php on line 369
[28-Dec-2016 08:16:17 America/Los_Angeles] Request URI: /index.php?main_page=checkout_process&action=confirm, IP address: AUTHnetIPaddress
#1  trigger_error() called at [/home/cpanelID/public_html/includes/functions/functions_email.php:376]
#2  zen_mail() called at [/home/cpanelID/public_html/includes/classes/order.php:1078]
#3  order->send_order_email() called at [/home/cpanelID/public_html/includes/modules/checkout_process.php:95]
#4  require(/home/cpanelID/public_html/includes/modules/checkout_process.php) called at [/home/cpanelID/public_html/includes/modules/pages/checkout_process/header_php.php:14]
#5  require(/home/cpanelID/public_html/includes/modules/pages/checkout_process/header_php.php) called at [/home/cpanelID/public_html/index.php:36]

[28-Dec-2016 08:16:17 America/Los_Angeles] PHP Notice:  Email Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting<br /> in /home/cpanelID/public_html/includes/functions/functions_email.php on line 376
[28-Dec-2016 08:16:17 America/Los_Angeles] Request URI: /index.php?main_page=checkout_process&action=confirm, IP address: http://cpanelIDvers.com
#1  stream_socket_enable_crypto() called at [/home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.smtp.php:369]
#2  SMTP->startTLS() called at [/home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.phpmailer.php:1635]
#3  PHPMailer->smtpConnect() called at [/home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.phpmailer.php:1498]
#4  PHPMailer->smtpSend() called at [/home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.phpmailer.php:1335]
#5  PHPMailer->postSend() called at [/home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.phpmailer.php:1213]
#6  PHPMailer->send() called at [/home/cpanelID/public_html/includes/functions/functions_email.php:348]
#7  zen_mail() called at [/home/cpanelID/public_html/includes/classes/order.php:1099]
#8  order->send_order_email() called at [/home/cpanelID/public_html/includes/modules/checkout_process.php:95]
#9  require(/home/cpanelID/public_html/includes/modules/checkout_process.php) called at [/home/cpanelID/public_html/includes/modules/pages/checkout_process/header_php.php:14]
#10 require(/home/cpanelID/public_html/includes/modules/pages/checkout_process/header_php.php) called at [/home/cpanelID/public_html/index.php:36]

[28-Dec-2016 08:16:17 America/Los_Angeles] PHP Warning:  stream_socket_enable_crypto(): Peer certificate CN=`*.tvsecure.com' did not match expected CN=`mail.cpanelIDvers.com' in /home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.smtp.php on line 369
[28-Dec-2016 08:16:17 America/Los_Angeles] Request URI: /index.php?main_page=checkout_process&action=confirm, IP address: http://cpanelIDvers.com
#1  stream_socket_enable_crypto() called at [/home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.smtp.php:369]
#2  SMTP->startTLS() called at [/home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.phpmailer.php:1635]
#3  PHPMailer->smtpConnect() called at [/home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.phpmailer.php:1498]
#4  PHPMailer->smtpSend() called at [/home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.phpmailer.php:1335]
#5  PHPMailer->postSend() called at [/home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.phpmailer.php:1213]
#6  PHPMailer->send() called at [/home/cpanelID/public_html/includes/functions/functions_email.php:348]
#7  zen_mail() called at [/home/cpanelID/public_html/includes/classes/order.php:1099]
#8  order->send_order_email() called at [/home/cpanelID/public_html/includes/modules/checkout_process.php:95]
#9  require(/home/cpanelID/public_html/includes/modules/checkout_process.php) called at [/home/cpanelID/public_html/includes/modules/pages/checkout_process/header_php.php:14]
#10 require(/home/cpanelID/public_html/includes/modules/pages/checkout_process/header_php.php) called at [/home/cpanelID/public_html/index.php:36]

[28-Dec-2016 08:16:17 America/Los_Angeles] PHP Warning:  stream_socket_enable_crypto(): Peer certificate CN=`*.tvsecure.com' did not match expected CN=`mail.cpanelIDvers.com' in /home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.smtp.php on line 369
[28-Dec-2016 08:16:17 America/Los_Angeles] Request URI: /index.php?main_page=checkout_process&action=confirm, IP address: AUTHnetIPaddress
#1  trigger_error() called at [/home/cpanelID/public_html/includes/functions/functions_email.php:376]
#2  zen_mail() called at [/home/cpanelID/public_html/includes/classes/order.php:1099]
#3  order->send_order_email() called at [/home/cpanelID/public_html/includes/modules/checkout_process.php:95]
#4  require(/home/cpanelID/public_html/includes/modules/checkout_process.php) called at [/home/cpanelID/public_html/includes/modules/pages/checkout_process/header_php.php:14]
#5  require(/home/cpanelID/public_html/includes/modules/pages/checkout_process/header_php.php) called at [/home/cpanelID/public_html/index.php:36]

[28-Dec-2016 08:16:17 America/Los_Angeles] PHP Notice:  Email Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting<br /> in /home/cpanelID/public_html/includes/functions/functions_email.php on line 376
30 Dec 2016, 3:51 PM
#3
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

Re: Failed sending email -- SMTP connect() failed - Peer certificate did not match

Restored original files from backup and email functionality OK.

No myDEBUG files generated.
email sent and received.

May want to edit original thread subject to reflect all email (not just manually generated from within Admin)

30 Dec 2016, 4:31 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,091
Plugin Contributions:
56

Re: Failed sending email -- SMTP connect() failed - Peer certificate did not match

I haven't had a chance to go through the code, but the following line 'stood out' for me:

... did not match expected CN=[B]`[/B]mail.cpanelIDvers.com' in /home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.smtp.php on line 369

That highlighted "single-quote" ... isn't!

30 Dec 2016, 4:55 PM
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,091
Plugin Contributions:
56

Re: Failed sending email -- SMTP connect() failed - Peer certificate did not match

lat9:

I haven't had a chance to go through the code, but the following line 'stood out' for me:

... did not match expected CN=[B]`[/B]mail.cpanelIDvers.com' in /home/cpanelID/public_html/includes/classes/vendors/PHPMailer/class.smtp.php on line 369

> That highlighted "single-quote" ... isn't!
Never mind; it looks like that's a red herring.
30 Dec 2016, 5:01 PM
#6
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

Re: Failed sending email -- SMTP connect() failed - Peer certificate did not match

Regarding the server certificates

Email from host says

This is the expected behavior. It is connecting to the server mail process, which uses our *.tvsecure.com mail certificate (which matches
vm31ae.tvsecure.com) -- There will always be a certificate mismatch in this instance. It is safe to disregard this error.

But this error prevents any order from completing. Prevents contact us from completing. Seems to prevent any email attempt from zencart from completing.

30 Dec 2016, 5:06 PM
#7
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,091
Plugin Contributions:
56

Re: Failed sending email -- SMTP connect() failed - Peer certificate did not match

Rick, does that mean that your cart's setting (in Configuration->Email Options) SMTP account email host should be vm31ae.tvsecure.com?

30 Dec 2016, 5:45 PM
#8
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

Re: Failed sending email -- SMTP connect() failed - Peer certificate did not match

lat9:

Rick, does that mean that your cart's setting (in Configuration->Email Options) SMTP account email host should be vm31ae.tvsecure.com?

I cannot answer that question. I guess it might be worth testing but I would rather have a 'trophy' instead of trial and error testing on the live server.

I see the main thread topic has been changed but it doesn't help me understand. The last thing I want is to be in the middle of a fingerpointing contest.

It doesn't make sense to me when things worked fine until the PHPmailer files were updated.

30 Dec 2016, 5:56 PM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Failed sending email -- SMTP connect() failed - Peer certificate did not match

The newer PHPMailer files are properly enforcing appropriate security rules, which your host is violating, particularly with mismatched certificates.

The error you're seeing is a misconfiguration problem. You need to connect to an email server/host whose name matches the TLS certificate being used with it.

Alternatively, if that doesn't work, there's a way to relax security but then that opens your site up to man-in-the-middle attacks.

Try lat9's suggestion first. It's the most logical.

30 Dec 2016, 6:06 PM
#10
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

Re: Failed sending email -- SMTP connect() failed - Peer certificate did not match

TNX DrByte,

That was my interpretation but sometimes my interpretations get me in trouble.

Too many server names/server certificates involved.

30 Dec 2016, 10:07 PM
#11
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

Re: Failed sending email -- SMTP connect() failed - Peer certificate did not match

lat9:

Rick, does that mean that your cart's setting (in Configuration->Email Options) SMTP account email host should be vm31ae.tvsecure.com?

Thanks for the suggestion Cindy.

Yes, that is working. Sure makes for a convoluted mess. I am tired of fingerpointing without enough personal knowledge to do anything but play middleman. The troubleshooting wiki listed in the myDEBUG indicates something to do with changes from php5.6 and forward.

I do remember having problems quite some time back with a failed PCI scan due to email server and the TLS setup and the fix was to replace mail.mydomain.com with the other code

This is all greek to me.

There's nothing we can do about the server SSL not matching your mail subdomain. There is also no security issue in sending email from your website, which is running PHP code on our server, to an smtp daemon on the same exact server. That traffic does not exit the server.