diff --git a/frappe/email/doctype/email_queue/email_queue.py b/frappe/email/doctype/email_queue/email_queue.py index 095471c82f..edccabc174 100644 --- a/frappe/email/doctype/email_queue/email_queue.py +++ b/frappe/email/doctype/email_queue/email_queue.py @@ -8,12 +8,14 @@ from frappe import _ from frappe.model.document import Document from frappe.email.queue import send_one from frappe.limits import get_limits +from frappe.utils import now_datetime + class EmailQueue(Document): def set_recipients(self, recipients): self.set("recipients", []) for r in recipients: - self.append("recipients", {"recipient":r}) + self.append("recipients", {"recipient":r, "status":"Not Sent"}) def on_trash(self): self.prevent_email_queue_delete() @@ -37,6 +39,9 @@ def retry_sending(name): doc.status = "Not Sent" doc.save(ignore_permissions=True) + frappe.db.sql("""update `tabEmail Queue Recipient` set status='Not Sent', modified=%s where parent=%s""", + (now_datetime(), name)) + @frappe.whitelist() def send_now(name): send_one(name, now=True)