Skip to content

Commit

Permalink
Fix dotkom possible duplicate address in error mail (#2989)
Browse files Browse the repository at this point in the history
  • Loading branch information
Terbau authored Feb 6, 2023
1 parent e2d879d commit 6bd765a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions utils/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ def handle_mail_error(
) -> None:
"""Callback called when an error occures while sending batched emails."""

dotkom_address = "[email protected]"
bcc = None
if to is not None and dotkom_address not in to:
bcc = [dotkom_address]

not_sent_recipients = list(
itertools.chain.from_iterable(em.recipients() for em in emails_not_sent)
)
Expand Down Expand Up @@ -48,11 +53,11 @@ def handle_mail_error(
body=message,
from_email="[email protected]", # TODO: Change??
to=to or [],
bcc=["[email protected]"],
bcc=bcc,
)
email.send()

logger.info(f"Sent error email to {', '.join(to or [])} and [email protected]")
logger.info(f"Sent error email to {', '.join((to or []) + (bcc or []))}")


class AutoChunkedEmailMessage:
Expand Down

0 comments on commit 6bd765a

Please sign in to comment.