From d0b73e9b679beb60e449c5afdaac3a8cc5f86372 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Tue, 16 Oct 2018 15:05:17 +0000 Subject: [PATCH] Tweaked the mail sending routines' handling of the copy flag. - Legacy-Id: 15586 --- ietf/utils/mail.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ietf/utils/mail.py b/ietf/utils/mail.py index 1dc9348c6..b002ce73c 100644 --- a/ietf/utils/mail.py +++ b/ietf/utils/mail.py @@ -264,11 +264,12 @@ def send_mail_mime(request, to, frm, subject, msg, cc=None, extra=None, toUser=F # then put USING_DEBUG_EMAIL_SERVER=True and EMAIL_HOST='localhost' # and EMAIL_PORT=2025 in settings_local.py 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 == 'development': show_that_mail_was_sent(request,'In production, email would have been sent',msg,bcc) - if test_mode or debugging or settings.SERVER_MODE == 'production': + if test_mode or debugging or production: try: send_smtp(msg, bcc) except smtplib.SMTPException as e: @@ -287,7 +288,7 @@ def send_mail_mime(request, to, frm, subject, msg, cc=None, extra=None, toUser=F copy_to = settings.EMAIL_COPY_TO except AttributeError: copy_to = "ietf.tracker.archive+%s@gmail.com" % settings.SERVER_MODE - if copy and copy_to and not test_mode and not debugging: # if we're running automated tests, this copy is just annoying + if copy_to and (copy or not production) and not (test_mode or debugging): # if we're running automated tests, this copy is just annoying if bcc: msg['X-Tracker-Bcc']=bcc try: