Forums / General Questions / SMTP connect() failed - i want to debug PHPMailer

SMTP connect() failed - i want to debug PHPMailer

Locked

Views: 6,822

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
8 Mar 2019, 8:45 AM
#1
amart79196 avatar

amart79196

New Zenner

Join Date:
Jul 2010
Posts:
72
Plugin Contributions:
0

SMTP connect() failed - i want to debug PHPMailer

I have 155f running and I have not changed much here in terms of anything that I can think of in the past few months. My site has been VERY quite for the last 3 months due to a down time with products as my items are not available year round.

Needless to say, I cant point to an exact day when I lost the ability to send emails from my admin panel.

Anytime I try to send an email from the admin panel weather it is via the tool menu or to update the status of an order, I get this error across the top of my screen in red. I copied and pasted it below:

"ERROR: Failed sending email to: "ZEN Test ACCOUNT" with subject: "test" SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting"

I went to the link provided and it says to turn on the debug logging.

Can anyone help with some detail as to how to go about changing the debug level to "2" as suggested in the wiki support article?

Also, can anyone help with telling me where this file is located that I would need to change as well as the output of the actual debug log?

Lastly, if an expert has a suggestion regarding possibly updating the phpmailer and if that move is safe (I don't have the time to update to the latest zencart for at least 4 months), maybe that will be a possible say to go. I do not know the version number of what came with 1.5.5f (is there a way to tell what it is??), but maybe Im running something outdated. I figured if this was a wide spread thing I would have seen others posting about this which also make me think this might be my hosting company changing things or a change to gsuite's backend...but again, I cant be the only one with this particular setup.

Many thanks in advance for any help that you can provide.

ZC version 155f
PHP version 7.1.2.2

8 Mar 2019, 7:49 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: SMTP connect() failed - i want to debug PHPMailer

The file in question appears to be:
includes/classes/vendors/PHPMailer/class.smtp.php

Where the $do_debug level can be set to one of the recommended constants and then the $Debugoutput could be changed to error_log and then the information will be stored in a mydebug log in your logs folder.

As to the software version, the email handling is now part of another package with the general idea that the package can be updated independent of the Zen Cart Version. That's the expectation at least.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

9 Mar 2019, 8:11 AM
#3
amart79196 avatar

amart79196

New Zenner

Join Date:
Jul 2010
Posts:
72
Plugin Contributions:
0

Re: SMTP connect() failed - i want to debug PHPMailer

This is the response that I got from my error logs. Can anyone make sense out of all of this?

[09-Mar-2019 08:02:47 UTC] Request URI: /catalog/admin/mail.php?action=send_email_to_user, IP address: 67.87.100.100
#1 trigger_error() called at [/home/store/public_html/catalog/includes/functions/functions_email.php:375]
#2 zen_mail() called at [/home/store/public_html/catalog/admin/mail.php:62]
[09-Mar-2019 08:02:47 UTC] PHP Notice: Email Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting<br /> in /home/store/public_html/catalog/includes/functions/functions_email.php on line 375

9 Mar 2019, 8:43 AM
#4
amart79196 avatar

amart79196

New Zenner

Join Date:
Jul 2010
Posts:
72
Plugin Contributions:
0

Re: SMTP connect() failed - i want to debug PHPMailer

Also, Some more news on this matter.

My settings are as follows in the admin panel and have been this way without issues for the longest of times.

E-mail Transport Method: smtpauth
SMTP E-Mail Server Port: 587

Its been this way for the longest that I can remember.

I did some testing that changed the Transport Method to "PHP". Also, I changed the port to "25" and I was not getting any errors and emails were finally working once again.

I'm not 100% sure what this proves outside of the fact that I was able to finally send an email to customer now.

Just for clarification in advance, Im using GSuite account. My smtp server is "smtp.gmail.com" and it has been that way for as long as I can remember and it worked. I didn't change that at all with my testing, only the transport method and the port.

Can anyone shed some light as to what is going on?

Lastly, I believe I have the less secure apps running on my gsuite account, but I will recheck it once more. Does this have to be this way as well?

Many thanks to anyone for their assistance.

9 Mar 2019, 9:09 AM
#5
amart79196 avatar

amart79196

New Zenner

Join Date:
Jul 2010
Posts:
72
Plugin Contributions:
0

Re: SMTP connect() failed - i want to debug PHPMailer

So, a bit more testing has found out this.

Back a month ago I turned on 2FA on my gsuite account. This actually disables the "less secure apps" in the account. Once I turned off the 2FA, all email errors went away.

Now the question is how can Zencart be able to send emails with the 2FA enabled and is sufficient for the security protocols that google has deemed mandatory for it to work without the need for 2FA to be turned off? Is this a PHPMailer problem or a Zencart problem?

If it is a PHPMailer problem, is there a substitute Mail program that can be included or installed into zencart to avoid this?

I did read that there is a “app passwords” setting in google account settings under “signing into google” on another website that was talking about this issue with their wordpress setup. The workaround that stated was "if 2 factor authentication is enabled, you can create application specific password that can be pasted into this particular email-smtp setup". Does anyone here know how to actually do this and set this up inside of Zencart? Is this something that needs to be changed inside of Zencart? Is this a google only thing? Not 100% sure on this.

9 Mar 2019, 9:41 AM
#6
amart79196 avatar

amart79196

New Zenner

Join Date:
Jul 2010
Posts:
72
Plugin Contributions:
0

Re: SMTP connect() failed - i want to debug PHPMailer

Well, I guess I found the solution...its all inside of google once you have 2FA turned on. Once inside, all you need to do is set up app passwords, then copy the 16 character password from there into the email password field in the email settings inside of your admin panel. Once this is done, it should be all set.

I just did this and my test worked out perfectly. I'll monitor this and hopefully this all sticks and I wont need to have any other changes. Lastly, I answered my own questions above, but this is a good thread to keep if anyone else is running into this situation and doesn't want to make their google account "less secure".