From 4e4f5b2d53aa3eafa82bec4681bcdac1b75cae86 Mon Sep 17 00:00:00 2001 From: Shreyas Patil Date: Fri, 23 Sep 2016 17:16:22 +0530 Subject: [PATCH] [Fix] Retry on Authentication error by Gmail, if emails are pulled from/pushed to server too frequently (#2090) * [Fix] Authentication error is raised by Gmail, if emails are pulled from/pushed to server too frequently * [Fix] Minor Fix --- frappe/email/smtp.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/frappe/email/smtp.py b/frappe/email/smtp.py index bd729ffe01..951f82c308 100644 --- a/frappe/email/smtp.py +++ b/frappe/email/smtp.py @@ -34,16 +34,14 @@ def send(email, append_to=None, retry=1): except smtplib.SMTPRecipientsRefused: frappe.msgprint(_("Invalid recipient address"), title='Email Failed') raise - except smtplib.SMTPServerDisconnected: + except (smtplib.SMTPServerDisconnected, smtplib.SMTPAuthenticationError): if not retry: raise else: retry = retry - 1 _send(retry) - _send(retry) - - + _send(retry) def get_outgoing_email_account(raise_exception_not_set=True, append_to=None): """Returns outgoing email account based on `append_to` or the default @@ -207,4 +205,3 @@ class SMTPServer: except smtplib.SMTPException: frappe.msgprint(_('Unable to send emails at this time')) raise -