Skip to content

Commit e87442f

Browse files
committed
Merged in [15282] from housley@vigilsec.com:
Set reply-to for I-D Announcements that include a CC to a mail list. Fixes ietf-tools#2530. - Legacy-Id: 15289 Note: SVN reference [15282] has been migrated to Git commit 733c304
2 parents 9d21124 + 733c304 commit e87442f

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

ietf/group/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1586,7 +1586,7 @@ def email_open_review_assignments(request, acronym, group_type=None):
15861586
if request.method == "POST" and request.POST.get("action") == "email":
15871587
form = EmailOpenAssignmentsForm(request.POST)
15881588
if form.is_valid():
1589-
send_mail_text(request, form.cleaned_data["to"], form.cleaned_data["frm"], form.cleaned_data["subject"], form.cleaned_data["body"],cc=form.cleaned_data["cc"],extra={"Reply-to":", ".join(form.cleaned_data["reply_to"])})
1589+
send_mail_text(request, form.cleaned_data["to"], form.cleaned_data["frm"], form.cleaned_data["subject"], form.cleaned_data["body"],cc=form.cleaned_data["cc"],extra={"Reply-To":", ".join(form.cleaned_data["reply_to"])})
15901590
return HttpResponseRedirect(back_url)
15911591
else:
15921592
(to,cc) = gather_address_lists('review_assignments_summarized',group=group)

ietf/message/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def infer_message(s):
1414
m.to = parsed.get("To", "").decode("utf-8")
1515
m.cc = parsed.get("Cc", "").decode("utf-8")
1616
m.bcc = parsed.get("Bcc", "").decode("utf-8")
17-
m.reply_to = parsed.get("Reply-to", "").decode("utf-8")
17+
m.reply_to = parsed.get("Reply-To", "").decode("utf-8")
1818
m.body = parsed.get_payload().decode("utf-8")
1919

2020
return m

ietf/submit/mail.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ def announce_to_lists(request, submission):
105105
m.subject = 'I-D Action: %s-%s.txt' % (submission.name, submission.rev)
106106
m.frm = settings.IDSUBMIT_ANNOUNCE_FROM_EMAIL
107107
(m.to, m.cc) = gather_address_lists('sub_announced',submission=submission)
108+
if m.cc:
109+
m.reply_to = m.cc
108110
m.body = render_to_string('submit/announce_to_lists.txt',
109111
dict(submission=submission,
110112
settings=settings))

ietf/submit/tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,8 +1501,8 @@ def do_submission_email(self, the_url, to, body):
15011501
outmsg = outbox[0]
15021502
self.assertTrue(to in outmsg['To'])
15031503

1504-
reply_to = outmsg['Reply-to']
1505-
self.assertIsNotNone(reply_to, "Expected Reply-to")
1504+
reply_to = outmsg['Reply-To']
1505+
self.assertIsNotNone(reply_to, "Expected Reply-To")
15061506

15071507
# Build a reply
15081508

ietf/utils/mail.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ def condition_message(to, frm, subject, msg, cc, extra):
206206
cc = ", ".join([isinstance(addr, tuple) and formataddr(addr) or addr for addr in cc if addr])
207207
if frm:
208208
msg['From'] = frm
209+
if extra and 'Reply-To' in extra:
210+
reply_to = extra['Reply-To']
211+
if isinstance(reply_to, list) or isinstance(reply_to, tuple):
212+
reply_to = ", ".join([isinstance(addr, tuple) and formataddr(addr) or addr for addr in reply_to if addr])
213+
extra['Reply-To'] = reply_to
209214

210215
# The following is a hack to avoid an issue with how the email module (as of version 4.0.3)
211216
# breaks lines when encoding header fields with anything other than the us-ascii codec.
@@ -265,7 +270,7 @@ def send_mail_mime(request, to, frm, subject, msg, cc=None, extra=None, toUser=F
265270

266271
if test_mode or debugging or settings.SERVER_MODE == 'production':
267272
try:
268-
send_smtp(msg,bcc)
273+
send_smtp(msg, bcc)
269274
except smtplib.SMTPException as e:
270275
log_smtp_exception(e)
271276
build_warning_message(request, e)
@@ -339,7 +344,7 @@ def send_mail_message(request, message, extra={}):
339344

340345
e = extra.copy()
341346
if message.reply_to:
342-
e['Reply-to'] = message.reply_to
347+
e['Reply-To'] = message.reply_to
343348
if message.msgid:
344349
e['Message-ID'] = message.msgid
345350

0 commit comments

Comments
 (0)