[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
This commit is contained in:
Shreyas Patil 2016-09-23 17:16:22 +05:30 committed by Rushabh Mehta
parent 5eb7e67322
commit 4e4f5b2d53

View file

@ -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