Skip to content

Commit

Permalink
fix: decode header fields for pop-up msg
Browse files Browse the repository at this point in the history
  • Loading branch information
jennifer-richards committed Oct 10, 2024
1 parent 702aadd commit b6546f7
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions ietf/utils/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,24 @@ def show_that_mail_was_sent(request: HttpRequest, leadline: str, msg: Message, b
"RG Secretary",
],
):
info = f"{leadline} at {timezone.now().strftime('%Y-%m-%d %H:%M:%S')} {settings.TIME_ZONE}\n"
info += f"Subject: {force_str(msg.get('Subject', '[no subject]'))}\n"
info += f"To: {msg.get('To', '[no to]')}\n"
if msg.get("Cc"):
info += f"Cc: {msg.get('Cc')}\n"
subject = decode_header_value(msg.get("Subject", "[no subject]"))
_to = decode_header_value(msg.get("To", "[no to]"))
info_lines = [
f"{leadline} at {timezone.now().strftime('%Y-%m-%d %H:%M:%S')} {settings.TIME_ZONE}",
f"Subject: {subject}",
f"To: {_to}",
]
cc = msg.get("Cc", None)
if cc is not None:
info_lines.append(f"Cc: {decode_header_value(cc)}")
if bcc:
info += f"Bcc: {bcc}\n"
messages.info(request, info, extra_tags="preformatted", fail_silently=True)
info_lines.append(f"Bcc: {decode_header_value(bcc)}")
messages.info(
request,
"\n".join(info_lines),
extra_tags="preformatted",
fail_silently=True,
)


def save_as_message(request, msg, bcc):
Expand Down

0 comments on commit b6546f7

Please sign in to comment.