Ensure success email subject is wired to EMAIL_SUBJECT_SUCCESS and never blank
Mirror and run GitLab CI / build (push) Has been cancelled
Ruff / ruff (push) Has been cancelled

This commit is contained in:
admin
2026-06-14 21:09:25 +00:00
parent 18f4a4e8de
commit 154cac6c7b
+9 -1
View File
@@ -162,12 +162,20 @@ def send_success_email(
""" """
Send final email with transcript and attachments. Send final email with transcript and attachments.
Subject is customizable via EMAIL_SUBJECT_SUCCESS. Subject is customizable via EMAIL_SUBJECT_SUCCESS.
Falls back to a safe default if the env var is missing or blank.
""" """
subject = _get_subject( subject = _get_subject(
"EMAIL_SUBJECT_SUCCESS", "EMAIL_SUBJECT_SUCCESS",
"ScrAIbe: Your transcript is ready", "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 = ( body = (
"Hello,\n\n" "Hello,\n\n"
"Your transcription is ready.\n\n" "Your transcription is ready.\n\n"
@@ -204,7 +212,7 @@ def send_success_email(
html=html, html=html,
attachments=attachments, 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: except EmailError as e:
logger.error("Failed to send success email to %s for job %s: %s", to, task_id, e) logger.error("Failed to send success email to %s for job %s: %s", to, task_id, e)