Skip to content

Commit 91d5d72

Browse files
committed
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
1 parent 7b5bebc commit 91d5d72

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ietf/utils/mail.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright The IETF Trust 2007-2019, All Rights Reserved
1+
# Copyright The IETF Trust 2007-2020, All Rights Reserved
22
# -*- coding: utf-8 -*-
33

44

@@ -345,6 +345,10 @@ def send_mail_mime(request, to, frm, subject, msg, cc=None, extra=None, toUser=F
345345
debugging = getattr(settings, "USING_DEBUG_EMAIL_SERVER", False) and settings.EMAIL_HOST == 'localhost' and settings.EMAIL_PORT == 2025
346346
production = settings.SERVER_MODE == 'production'
347347

348+
if settings.SERVER_MODE == 'repair':
349+
log("\nIn repair mode: Skipped email from '%s' to %s id %s subject '%s'" % (frm, to, msg.get('Message-ID', ''), subject))
350+
return msg
351+
348352
if settings.SERVER_MODE == 'development':
349353
show_that_mail_was_sent(request,'In production, email would have been sent',msg,bcc)
350354

0 commit comments

Comments
 (0)