Merged in [15282] from housley@vigilsec.com:
Set reply-to for I-D Announcements that include a CC to a mail list. Fixes #2530.
- Legacy-Id: 15289
Note: SVN reference [15282] has been migrated to Git commit 733c304e3d
This commit is contained in:
commit
e87442f33a
|
@ -1586,7 +1586,7 @@ def email_open_review_assignments(request, acronym, group_type=None):
|
|||
if request.method == "POST" and request.POST.get("action") == "email":
|
||||
form = EmailOpenAssignmentsForm(request.POST)
|
||||
if form.is_valid():
|
||||
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"])})
|
||||
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"])})
|
||||
return HttpResponseRedirect(back_url)
|
||||
else:
|
||||
(to,cc) = gather_address_lists('review_assignments_summarized',group=group)
|
||||
|
|
|
@ -14,7 +14,7 @@ def infer_message(s):
|
|||
m.to = parsed.get("To", "").decode("utf-8")
|
||||
m.cc = parsed.get("Cc", "").decode("utf-8")
|
||||
m.bcc = parsed.get("Bcc", "").decode("utf-8")
|
||||
m.reply_to = parsed.get("Reply-to", "").decode("utf-8")
|
||||
m.reply_to = parsed.get("Reply-To", "").decode("utf-8")
|
||||
m.body = parsed.get_payload().decode("utf-8")
|
||||
|
||||
return m
|
||||
|
|
|
@ -105,6 +105,8 @@ def announce_to_lists(request, submission):
|
|||
m.subject = 'I-D Action: %s-%s.txt' % (submission.name, submission.rev)
|
||||
m.frm = settings.IDSUBMIT_ANNOUNCE_FROM_EMAIL
|
||||
(m.to, m.cc) = gather_address_lists('sub_announced',submission=submission)
|
||||
if m.cc:
|
||||
m.reply_to = m.cc
|
||||
m.body = render_to_string('submit/announce_to_lists.txt',
|
||||
dict(submission=submission,
|
||||
settings=settings))
|
||||
|
|
|
@ -1501,8 +1501,8 @@ Thank you
|
|||
outmsg = outbox[0]
|
||||
self.assertTrue(to in outmsg['To'])
|
||||
|
||||
reply_to = outmsg['Reply-to']
|
||||
self.assertIsNotNone(reply_to, "Expected Reply-to")
|
||||
reply_to = outmsg['Reply-To']
|
||||
self.assertIsNotNone(reply_to, "Expected Reply-To")
|
||||
|
||||
# Build a reply
|
||||
|
||||
|
|
|
@ -206,6 +206,11 @@ def condition_message(to, frm, subject, msg, cc, extra):
|
|||
cc = ", ".join([isinstance(addr, tuple) and formataddr(addr) or addr for addr in cc if addr])
|
||||
if frm:
|
||||
msg['From'] = frm
|
||||
if extra and 'Reply-To' in extra:
|
||||
reply_to = extra['Reply-To']
|
||||
if isinstance(reply_to, list) or isinstance(reply_to, tuple):
|
||||
reply_to = ", ".join([isinstance(addr, tuple) and formataddr(addr) or addr for addr in reply_to if addr])
|
||||
extra['Reply-To'] = reply_to
|
||||
|
||||
# The following is a hack to avoid an issue with how the email module (as of version 4.0.3)
|
||||
# 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
|
|||
|
||||
if test_mode or debugging or settings.SERVER_MODE == 'production':
|
||||
try:
|
||||
send_smtp(msg,bcc)
|
||||
send_smtp(msg, bcc)
|
||||
except smtplib.SMTPException as e:
|
||||
log_smtp_exception(e)
|
||||
build_warning_message(request, e)
|
||||
|
@ -339,7 +344,7 @@ def send_mail_message(request, message, extra={}):
|
|||
|
||||
e = extra.copy()
|
||||
if message.reply_to:
|
||||
e['Reply-to'] = message.reply_to
|
||||
e['Reply-To'] = message.reply_to
|
||||
if message.msgid:
|
||||
e['Message-ID'] = message.msgid
|
||||
|
||||
|
|
Loading…
Reference in a new issue