Welcome Guest, Not a member yet? Register   Sign In
intermittent smtp failures with gmail
#1

CI version 3.1.13
We've seen this more than a few times where, out of the blue, sending mail thru google randomly declines to auth.  Usually about 24 hours or so later the problem resolves itself.  

No changes to my config/email.php file since Dec of '23.  

Sending 200ish emails a day will work fine for months on end, and then suddenly I human notified that emails that CI has sent are not appearing in the gmail sent mail folder.  

The CI logs show about 1 in 10 smtp failure messages like the one below.  Server is running on a DigitalOcean droplet in the SF region.  Requested help at DO as well.

How can I best troubleshoot this? 

Code:
220 [url=http://smtp.googlemail.com]smtp.googlemail.com[/url] ESMTP<uuid>.110 - gsmtp
<br /><pre>hello: 250-smtp.googlemail.com at your service, [159.65.78.78]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
</pre>Failed to authenticate password. Error: 535-5.7.8 Username and Password not accepted. For more information, go to
535 5.7.8  [url=https://support.google.com/mail/?p=BadCredentials]https://support.google.com/mail/?p=BadCredentials[/url] <uuid>.110 - gsmtp
<br />Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.<br /><pre>Date: Thu, 24 Apr 2025 15:24:09 +0000

My config/email.php:

Code:
$config['useragent'] = '';
$config['protocol'] = 'smtp'; 
$config['mailpath'] = '/usr/sbin/sendmail'; 
$config['smtp_host'] = 'ssl://smtp.googlemail.com'; 
$config['smtp_user'] = '[email protected]'; 
$config['smtp_pass'] = 'passwd'; 
$config['smtp_port'] = 465; 
$config['smtp_timeout'] = 30; 
$config['smtp_keepalive'] = FALSE; 
$config['smtp_crypto'] = ""; 
$config['wordwrap'] = TRUE; 
$config['wrapchars'] = 76; 
$config['mailtype'] = 'html'; 
$config['charset'] = 'utf-8';
$config['validate'] = FALSE;
$config['priority'] = '3'; 
$config['crlf'] = "\r\n"; 
$config['newline'] = "\r\n"; 
$config['bcc_batch_mode'] = ''; 
$config['bcc_batch_size'] = ''; 
$config['dsn'] = ''; 
Reply
#2

Try raising the SMTP Timeout to 60 seconds.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB