Skip to content

Commit

Permalink
Changed the header to last call messages to IETF Announce and to IANA…
Browse files Browse the repository at this point in the history
… to make replying to the announcement less likely to create an unnecessary ticket

 - Legacy-Id: 5602
  • Loading branch information
rjsparks committed Mar 27, 2013
1 parent 63cad71 commit 19dcf10
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
1 change: 0 additions & 1 deletion ietf/idrfc/mails.py
Expand Up @@ -488,7 +488,6 @@ def email_iana(request, doc, to, msg):

def extra_automation_headers(doc):
extra = {}
extra["Reply-To"] = "noreply@ietf.org"
extra["X-IETF-Draft-string"] = doc.name
extra["X-IETF-Draft-revision"] = doc.rev

Expand Down
6 changes: 3 additions & 3 deletions ietf/idrfc/views_ballot.py
Expand Up @@ -820,7 +820,7 @@ def ballot_writeupnotesREDESIGN(request, name):
msg = generate_issue_ballot_mail(request, doc, ballot)
send_mail_preformatted(request, msg)
send_mail_preformatted(request, msg, extra=extra_automation_headers(doc),
override={ "To": "IANA <drafts-eval@icann.org>" })
override={ "To": "IANA <drafts-eval@icann.org>", "CC": None, "Bcc": None , "Reply-To": None})

e = DocEvent(doc=doc, by=login)
e.by = login
Expand Down Expand Up @@ -1056,7 +1056,7 @@ def approve_ballotREDESIGN(request, name):

if action == "to_announcement_list":
send_mail_preformatted(request, announcement, extra=extra_automation_headers(doc),
override={ "To": "IANA <drafts-approval@icann.org>" })
override={ "To": "IANA <drafts-approval@icann.org>", "CC": None, "Bcc": None, "Reply-To": None})

msg = infer_message(announcement)
msg.by = login
Expand Down Expand Up @@ -1098,7 +1098,7 @@ def make_last_call(request, name):
if form.is_valid():
send_mail_preformatted(request, announcement)
send_mail_preformatted(request, announcement, extra=extra_automation_headers(doc),
override={ "To": "IANA <drafts-lastcall@icann.org>" })
override={ "To": "IANA <drafts-lastcall@icann.org>", "CC": None, "Bcc": None, "Reply-To": None})

msg = infer_message(announcement)
msg.by = login
Expand Down
8 changes: 5 additions & 3 deletions ietf/templates/idrfc/last_call_announcement.txt
@@ -1,7 +1,9 @@
{% load ietf_filters %}{% load mail_filters %}{% autoescape off %}From: The IESG <iesg-secretary@ietf.org>
To: IETF-Announce <ietf-announce@ietf.org>{% if cc %}
{% load ietf_filters %}{% load mail_filters %}{% autoescape off %}From: The IESG <noreply@ietf.org>
To: IETF-Announce:; {% if cc %}
CC: {{ cc }}{% endif %}
Reply-To: ietf@ietf.org
Bcc: <ietf-announce@ietf.org>
Reply-To: IETF Discussion List <ietf@ietf.org>
Sender: <iesg-secretary@ietf.org>
Subject: Last Call: {{ doc.file_tag }} ({{ doc.title|clean_whitespace }}) to {{ doc|std_level_prompt }}

{% filter wordwrap:73 %}
Expand Down
17 changes: 11 additions & 6 deletions ietf/utils/mail.py
Expand Up @@ -93,7 +93,7 @@ def send_smtp(msg, bcc=None):
server.quit()
log("sent email from '%s' to %s subject '%s'" % (frm, to, msg.get('Subject', '[no subject]')))

def copy_email(msg, to, toUser=False):
def copy_email(msg, to, toUser=False, originalBcc=None):
'''
Send a copy of the given email message to the given recipient.
'''
Expand All @@ -111,6 +111,8 @@ def copy_email(msg, to, toUser=False):
explanation = "The attached message was generated by an instance of the tracker\nin test mode. It is being sent to you because you, or someone acting\non your behalf, is testing the system. If you do not recognize\nthis action, please accept our apologies and do not be concerned as\nthe action is being taken in a test context."
else:
explanation = "The attached message would have been sent, but the tracker is in %s mode.\nIt was not sent to anybody." % settings.SERVER_MODE
if originalBcc:
explanation += ("\nIn addition to the destinations derived from the header below, the message would have been sent Bcc to %s" % originalBcc)
new.attach(MIMEText(explanation + "\n\n"))
new.attach(MIMEMessage(msg))
# Overwrite the From: header, so that the copy from a development or
Expand Down Expand Up @@ -177,17 +179,17 @@ def send_mail_mime(request, to, frm, subject, msg, cc=None, extra=None, toUser=F
send_smtp(msg, bcc)
elif settings.SERVER_MODE == 'test':
if toUser:
copy_email(msg, to, toUser=True)
copy_email(msg, to, toUser=True, originalBcc=bcc)
elif request and request.COOKIES.has_key( 'testmailcc' ):
copy_email(msg, request.COOKIES[ 'testmailcc' ])
copy_email(msg, request.COOKIES[ 'testmailcc' ],originalBcc=bcc)
try:
copy_to = settings.EMAIL_COPY_TO
except AttributeError:
copy_to = "ietf.tracker.archive+%s@gmail.com" % settings.SERVER_MODE
if copy_to and not test_mode: # if we're running automated tests, this copy is just annoying
if bcc:
msg['X-Tracker-Bcc']=bcc
copy_email(msg, copy_to)
copy_email(msg, copy_to,originalBcc=bcc)

def send_mail_preformatted(request, preformatted, extra={}, override={}):
"""Parse preformatted string containing mail with From:, To:, ...,
Expand All @@ -201,14 +203,17 @@ def send_mail_preformatted(request, preformatted, extra={}, override={}):
msg[k] = v

headers = copy.copy(msg)
for key in ['To', 'From', 'Subject']:
for key in ['To', 'From', 'Subject', 'Bcc']:
del headers[key]
for k, v in extra.iteritems():
if k in headers:
del headers[k]
headers[k] = v

send_mail_text(request, msg['To'], msg["From"], msg["Subject"], msg.get_payload(), extra=headers)
bcc = msg['Bcc']
del msg['Bcc']

send_mail_text(request, msg['To'], msg["From"], msg["Subject"], msg.get_payload(), extra=headers, bcc=bcc)

def send_mail_message(request, message, extra={}):
"""Send a Message object."""
Expand Down

0 comments on commit 19dcf10

Please sign in to comment.