Ensure success email subject is wired to EMAIL_SUBJECT_SUCCESS and never blank
This commit is contained in:
+9
-1
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user