This commit is contained in:
zandercymatics 2024-05-24 13:38:26 -06:00
parent 6342f63596
commit 5c1e41bb55
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 6 additions and 3 deletions

View file

@ -9,7 +9,6 @@ from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from waffle import switch_is_active
from django.conf import settings
logger = logging.getLogger(__name__)
@ -38,7 +37,8 @@ def send_templated_email(
Raises EmailSendingError if SES client could not be accessed
"""
if switch_is_active("disable_email_sending") and not settings.IS_PRODUCTION:
raise EmailSendingError("Could not send email. Email sending is disabled due to switch 'disable_email_sending'.")
message = "Could not send email. Email sending is disabled due to switch 'disable_email_sending'."
raise EmailSendingError(message)
template = get_template(template_name)
email_body = template.render(context=context)