-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix dotkom possible duplicate address in error mail (#2989)
- Loading branch information
Showing
1 changed file
with
7 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
) | ||
|
@@ -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: | ||
|