From e2f4c076c7ae37658ebfda08cc83c974f3249107 Mon Sep 17 00:00:00 2001 From: "Chinmay D. Pai" Date: Mon, 30 Sep 2019 15:32:11 +0530 Subject: [PATCH] fix(notifications): do not send emails if no recipients notifications triggered through hooks have no checks for recipients, if no recipients exist, sending mails shouldn't be attempted Signed-off-by: Chinmay D. Pai --- frappe/email/doctype/notification/notification.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frappe/email/doctype/notification/notification.py b/frappe/email/doctype/notification/notification.py index f8d3002a2c..6ae4243775 100644 --- a/frappe/email/doctype/notification/notification.py +++ b/frappe/email/doctype/notification/notification.py @@ -143,6 +143,8 @@ def get_context(context): attachments = self.get_attachment(doc) recipients, cc, bcc = self.get_list_of_recipients(doc, context) + if not recipients: + return sender = None if self.sender and self.sender_email: sender = formataddr((self.sender, self.sender_email))