mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-15 14:04:10 +02:00
minor email refactor
This commit is contained in:
parent
43b48edf36
commit
7a4ed7ab05
1 changed files with 3 additions and 5 deletions
|
@ -76,7 +76,7 @@ def send_templated_email( # noqa
|
||||||
aws_secret_access_key=settings.AWS_SECRET_ACCESS_KEY,
|
aws_secret_access_key=settings.AWS_SECRET_ACCESS_KEY,
|
||||||
config=settings.BOTO_CONFIG,
|
config=settings.BOTO_CONFIG,
|
||||||
)
|
)
|
||||||
logger.info(f"An email was sent! Template name: {template_name} to {to_address}")
|
logger.info(f"Connected to SES client! Template name: {template_name} to {to_address}")
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.debug("E-mail unable to send! Could not access the SES client.")
|
logger.debug("E-mail unable to send! Could not access the SES client.")
|
||||||
raise EmailSendingError("Could not access the SES client.") from exc
|
raise EmailSendingError("Could not access the SES client.") from exc
|
||||||
|
@ -153,14 +153,12 @@ def get_sendable_addresses(addresses: list[str]) -> tuple[list[str], list[str]]:
|
||||||
Paramaters:
|
Paramaters:
|
||||||
|
|
||||||
addresses: a list of strings representing all addresses to be checked.
|
addresses: a list of strings representing all addresses to be checked.
|
||||||
|
|
||||||
raises:
|
|
||||||
EmailSendingError if email sending is disabled
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if flag_is_active(None, "disable_email_sending"): # type: ignore
|
if flag_is_active(None, "disable_email_sending"): # type: ignore
|
||||||
message = "Could not send email. Email sending is disabled due to flag 'disable_email_sending'."
|
message = "Could not send email. Email sending is disabled due to flag 'disable_email_sending'."
|
||||||
raise EmailSendingError(message)
|
logger.warning(message)
|
||||||
|
return ([],[])
|
||||||
else:
|
else:
|
||||||
AllowedEmail = apps.get_model("registrar", "AllowedEmail")
|
AllowedEmail = apps.get_model("registrar", "AllowedEmail")
|
||||||
allowed_emails = []
|
allowed_emails = []
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue