From 965a7460ac21860050b9e1727b36301df741f2c0 Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Wed, 16 Aug 2017 20:04:10 +0530 Subject: [PATCH] [hotfix] set email queue status to Not Sent (#3941) --- frappe/patches.txt | 1 + frappe/patches/v8_7/__init__.py | 0 frappe/patches/v8_7/update_email_queue_status.py | 13 +++++++++++++ 3 files changed, 14 insertions(+) create mode 100644 frappe/patches/v8_7/__init__.py create mode 100644 frappe/patches/v8_7/update_email_queue_status.py diff --git a/frappe/patches.txt b/frappe/patches.txt index a9a28d5f05..ce0a749126 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -191,3 +191,4 @@ frappe.patches.v8_1.delete_custom_docperm_if_doctype_not_exists frappe.patches.v8_5.delete_email_group_member_with_invalid_emails frappe.patches.v8_x.update_user_permission frappe.patches.v8_5.patch_event_colors +frappe.patches.v8_7.update_email_queue_status diff --git a/frappe/patches/v8_7/__init__.py b/frappe/patches/v8_7/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/frappe/patches/v8_7/update_email_queue_status.py b/frappe/patches/v8_7/update_email_queue_status.py new file mode 100644 index 0000000000..8dcbcc57d6 --- /dev/null +++ b/frappe/patches/v8_7/update_email_queue_status.py @@ -0,0 +1,13 @@ +from __future__ import unicode_literals +import frappe +from frappe.email.smtp import get_default_outgoing_email_account + +def execute(): + # set the email queue status to Not Sent if google_analytics_id is UA-8911157-19 + default_email_account = get_default_outgoing_email_account() + + if frappe.conf.get("google_analytics_id") == "UA-8911157-19" or \ + default_email_account.email_id == "notifications@erpnext.com": + + frappe.db.sql("""update `tabEmail Queue` set status='Not Sent' where + creation>=DATE_SUB(NOW(), INTERVAL 16 HOUR)""") \ No newline at end of file