[fix] catch specific smtp exceptions in bulk flush for future retry
This commit is contained in:
parent
09ebb908ad
commit
ea79dc6f40
1 changed files with 8 additions and 1 deletions
|
|
@ -216,11 +216,18 @@ def flush(from_test=False):
|
|||
frappe.db.sql("""update `tabBulk Email` set status='Sent' where name=%s""",
|
||||
(email["name"],), auto_commit=auto_commit)
|
||||
|
||||
except smtplib.SMTPException:
|
||||
except (smtplib.SMTPServerDisconnected,
|
||||
smtplib.SMTPConnectError,
|
||||
smtplib.SMTPHeloError,
|
||||
smtplib.SMTPAuthenticationError):
|
||||
|
||||
# bad connection, retry later
|
||||
frappe.db.sql("""update `tabBulk Email` set status='Not Sent' where name=%s""",
|
||||
(email["name"],), auto_commit=auto_commit)
|
||||
|
||||
# no need to attempt further
|
||||
return
|
||||
|
||||
except Exception, e:
|
||||
frappe.db.sql("""update `tabBulk Email` set status='Error', error=%s
|
||||
where name=%s""", (unicode(e), email["name"]), auto_commit=auto_commit)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue