From 268e7ad644da00daeb0cbebdc0e0b2e92673b0a3 Mon Sep 17 00:00:00 2001 From: robert schouten Date: Fri, 3 Feb 2017 16:59:21 +0800 Subject: [PATCH] [hotfix] stop frappe sending automatic responses from non user generated emails (#2674) --- frappe/email/doctype/email_account/email_account.py | 6 ++++++ frappe/email/email_body.py | 1 + 2 files changed, 7 insertions(+) diff --git a/frappe/email/doctype/email_account/email_account.py b/frappe/email/doctype/email_account/email_account.py index e94d085944..548b06bc81 100755 --- a/frappe/email/doctype/email_account/email_account.py +++ b/frappe/email/doctype/email_account/email_account.py @@ -361,6 +361,12 @@ class EmailAccount(Document): communication.reference_doctype = parent.doctype communication.reference_name = parent.name + # check if message is notification and disable notifications for this message + isnotification = email.mail.get("isnotification") + if isnotification: + if "notification" in isnotification: + communication.unread_notification_sent = 1 + def set_sender_field_and_subject_field(self): '''Identify the sender and subject fields from the `append_to` DocType''' # set subject_field and sender_field diff --git a/frappe/email/email_body.py b/frappe/email/email_body.py index ca5c82863a..39b436fa4c 100755 --- a/frappe/email/email_body.py +++ b/frappe/email/email_body.py @@ -188,6 +188,7 @@ class EMail: self.msg_root["Message-Id"] = '<' + message_id + '>' else: self.msg_root["Message-Id"] = get_message_id() + self.msg_root["isnotification"] = '' def set_in_reply_to(self, in_reply_to): """Used to send the Message-Id of a received email back as In-Reply-To"""