From d0009095476e6d3863cda4c192cea3d93b3b24ba Mon Sep 17 00:00:00 2001 From: kyokukou Date: Wed, 3 Jun 2026 11:50:09 -0700 Subject: [PATCH] encourage email threading --- app/email.py | 4 ++++ app/process.py | 1 + 2 files changed, 5 insertions(+) diff --git a/app/email.py b/app/email.py index 4bab5df..a3e30f5 100644 --- a/app/email.py +++ b/app/email.py @@ -16,6 +16,7 @@ def send_email( subject: str, body: str, html_body: str, + submission_id: int, reply_to_emails: Optional[list[str]] = None, ) -> None: """Send a plain-text and HTML email via the Halon SMTP relay.""" @@ -44,9 +45,12 @@ def send_email( bcc_emails = [] #build email + thread_root = f"" msg = email.message.EmailMessage() msg["Date"] = format_datetime(localtime()) msg["Message-ID"] = make_msgid() + msg["In-Reply-To"] = thread_root + msg["References"] = thread_root msg["From"] = settings.MAIL_FROM msg["To"] = ", ".join(to_emails) msg["Subject"] = subject diff --git a/app/process.py b/app/process.py index 745c836..25efd01 100644 --- a/app/process.py +++ b/app/process.py @@ -155,6 +155,7 @@ def _send_email_tasks( subject=subject, body=body_text, html_body=body_html, + submission_id=task.submission_id, reply_to_emails=task.reply_to_emails, ) ack_fn(task.notifications.ack_ids) # ack only after successful send