From 91d5d72a9d1a9d53c00cb472b51222d9c1c83027 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Sun, 16 Feb 2020 21:42:37 +0000 Subject: [PATCH] Tweaked send_mail_mime() to recognize settings.SERVER_MODE='repair', in order to avoid mail floods when running the 'mergedata' management command. It is assumed that the appropriate mails went out when the data was entered into the system the first time. - Legacy-Id: 17301 --- ietf/utils/mail.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ietf/utils/mail.py b/ietf/utils/mail.py index 90aaef863..f9af311a5 100644 --- a/ietf/utils/mail.py +++ b/ietf/utils/mail.py @@ -1,4 +1,4 @@ -# Copyright The IETF Trust 2007-2019, All Rights Reserved +# Copyright The IETF Trust 2007-2020, All Rights Reserved # -*- coding: utf-8 -*- @@ -345,6 +345,10 @@ def send_mail_mime(request, to, frm, subject, msg, cc=None, extra=None, toUser=F debugging = getattr(settings, "USING_DEBUG_EMAIL_SERVER", False) and settings.EMAIL_HOST == 'localhost' and settings.EMAIL_PORT == 2025 production = settings.SERVER_MODE == 'production' + if settings.SERVER_MODE == 'repair': + log("\nIn repair mode: Skipped email from '%s' to %s id %s subject '%s'" % (frm, to, msg.get('Message-ID', ''), subject)) + return msg + if settings.SERVER_MODE == 'development': show_that_mail_was_sent(request,'In production, email would have been sent',msg,bcc)