From 154cac6c7b8e2ee17d6109d851e0259ef9bee4d0 Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 14 Jun 2026 21:09:25 +0000 Subject: [PATCH] Ensure success email subject is wired to EMAIL_SUBJECT_SUCCESS and never blank --- scraibe/tasks.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scraibe/tasks.py b/scraibe/tasks.py index fec0537..73ff245 100644 --- a/scraibe/tasks.py +++ b/scraibe/tasks.py @@ -162,12 +162,20 @@ def send_success_email( """ Send final email with transcript and attachments. Subject is customizable via EMAIL_SUBJECT_SUCCESS. + Falls back to a safe default if the env var is missing or blank. """ subject = _get_subject( "EMAIL_SUBJECT_SUCCESS", "ScrAIbe: Your transcript is ready", ) + # Ensure subject is never blank + if not subject.strip(): + subject = "ScrAIbe: Your transcript is ready" + logger.warning("EMAIL_SUBJECT_SUCCESS was blank; using default subject.") + else: + logger.info("Using success email subject: %s", subject) + body = ( "Hello,\n\n" "Your transcription is ready.\n\n" @@ -204,7 +212,7 @@ def send_success_email( html=html, attachments=attachments, ) - logger.info("Success email sent to %s for job %s", to, task_id) + logger.info("Success email sent to %s for job %s with subject: %s", to, task_id, subject) except EmailError as e: logger.error("Failed to send success email to %s for job %s: %s", to, task_id, e)