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
This commit is contained in:
Henrik Levkowetz 2020-02-16 21:42:37 +00:00
parent 7b5bebc727
commit 91d5d72a9d

View file

@ -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)