Skip to content

Commit d0b73e9

Browse files
committed
Tweaked the mail sending routines' handling of the copy flag.
- Legacy-Id: 15586
1 parent e20e8b7 commit d0b73e9

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

ietf/utils/mail.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,12 @@ def send_mail_mime(request, to, frm, subject, msg, cc=None, extra=None, toUser=F
264264
# then put USING_DEBUG_EMAIL_SERVER=True and EMAIL_HOST='localhost'
265265
# and EMAIL_PORT=2025 in settings_local.py
266266
debugging = getattr(settings, "USING_DEBUG_EMAIL_SERVER", False) and settings.EMAIL_HOST == 'localhost' and settings.EMAIL_PORT == 2025
267+
production = settings.SERVER_MODE == 'production'
267268

268269
if settings.SERVER_MODE == 'development':
269270
show_that_mail_was_sent(request,'In production, email would have been sent',msg,bcc)
270271

271-
if test_mode or debugging or settings.SERVER_MODE == 'production':
272+
if test_mode or debugging or production:
272273
try:
273274
send_smtp(msg, bcc)
274275
except smtplib.SMTPException as e:
@@ -287,7 +288,7 @@ def send_mail_mime(request, to, frm, subject, msg, cc=None, extra=None, toUser=F
287288
copy_to = settings.EMAIL_COPY_TO
288289
except AttributeError:
289290
copy_to = "ietf.tracker.archive+%s@gmail.com" % settings.SERVER_MODE
290-
if copy and copy_to and not test_mode and not debugging: # if we're running automated tests, this copy is just annoying
291+
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
291292
if bcc:
292293
msg['X-Tracker-Bcc']=bcc
293294
try:

0 commit comments

Comments
 (0)