Jump to content

SMTP via GMAIL - Has ANYONE gotten this to work reliably?


garybarr

Recommended Posts

I am having problems with sending email through GMAIL.   After a LOT of playing a year ago, I got it to work... But now over the last month, it works. stop working, then seems to start working as I play with things... But never the same thing... and the funny thing, what I play with, doesn't work, I change it back to the way I had it and it will start mysteriously working again... Then after some time... the error comes back:

Email Sending Failed - SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

I have it set to

image.png.84939cb39cce14b68de1fc71461679f0.png

 

I turned off SSL type to none and then turn it back on to TLS (original setting) and it went back to working one time, however, hasn't ever worked again on future breaks... I've changed the host to tls://smtp:gmail.com and it started working... for a while.  I'm sure it something I haven't completed correctly, but I can't seem to figure out what it is...  

I have added all the GMAIL IP's to my whitelist, I've made sure the 587 port is open on the Hostgator firewall...  Still... Email Sending Fail - SMT connect() failed.

 

Any ideas?

I wish I could run away from gmail, but it's what our company uses and we are too far in to ditch it now.

Link to comment
Share on other sites

Yeah, I have tried that also.. and it didn't work.  I just tried it again, just to make sure.    I'm stuck in the triangle of Hostgator - Google - WHMCS...  All saying it's someone else.  I believe it's Hostgator issue, but I can't prove it... and all the ports are opened, the IP's are whitelisted and I can "telnet smtp.gmail.com 587" and it connects from the server, so it doesn't seem to be blocked.   I could believe it's Google blocking it, but I verified the "Less Secure" setting is turned on to allow outside connections...and I'm able to send/receive using Thunderbird from my computer...  So it seems to be playing nice with outside connections...

I can get it to send email by turning it to PHP Mail() instead of SMTP... But in the past, we had problems with some servers blocking the mail when I sent it that way.  

 

 

Link to comment
Share on other sites

Works reliably for me. 

When you first set it up you usually have to visit the following link and enable less secure apps.
https://www.google.com/settings/security/lesssecureapps

You also sometimes needed to disable captcha during the first login attempt although not sure if it's still the case.
https://accounts.google.com/displayunlockcaptcha

Also, it appears that google is now more aggressive in blocking new sign in attempts from addresses it does not recognize.   So if you log in to the google account after you try connect from WHMCS you may see a security warning asking you to verify and accept the unknown login attempt.

 

 

Edited by mustardman
Link to comment
Share on other sites

Yeah, those were already in place... Like I said, it was working fine for over a year... and while I was on vacation (and nobody else has access), it stopped working.  I changed some things, no difference, then change it back to exactly how it was before and it started working again.... Only 2 weeks later, it broke again...  Only this time, I can't find any way to get it to work now.

Link to comment
Share on other sites

  • WHMCS Developer

You can see a little (a lot) more debug information using SMTP Debugging = https://docs.whmcs.com/Email_Sending_Issues#Troubleshooting

In addition to $smtp_debug = true; you can also define a number to increase the logging verbosity, eg $smtp_debug = 4;

Attempt to send an email to your client from the Emails tab, or using the Mass Mail option to see the debug information.

Finally, if you open a ticket, support can provide an SMTP test script to run some additional tests for you.

Link to comment
Share on other sites

It looks like I solved the problem, so I wanted to update this in case others run into a problem...

For reasons I don't understand, they will start blocking WHMCS using the standard password for the account.  So, you have to login to your G Suite account and click on MyAccount.  Then go to Sign-In & Security, and under App Passwords, you will want to create a password there.  It'll give you a password to use instead of your own password, so that it knows you are using an app connection.

 

Then, it works just fine.  

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated