update to backend.py and utils.py to suport changes in signals.py

This commit is contained in:
Raymond Jessop 2025-04-18 14:58:38 -05:00
parent c0b71c4060
commit f49706a476
2 changed files with 8 additions and 0 deletions

View File

@ -242,6 +242,7 @@ class SESBackend(BaseEmailBackend):
f"message_id={message.extra_headers['message_id']}, request_id={message.extra_headers['request_id']}"
)
list_of_response.append(response)
signals.email_post_send.send_robust(self.__class__, message=message)
except ResponseError as err:
logger.error(f"Failed to send email: {err}")
message.extra_headers.update({

View File

@ -212,6 +212,13 @@ def receiver_email_pre_send(sender, message=None, **kwargs):
"""
pass
@receiver(signals.email_post_send)
def receiver_email_post_send(sender, message=None, **kwargs):
"""Handle post-send actions (e.g., log success, update metrics)."""
if message:
logger.info(f"Email sent successfully to {message.recipients()}")
# Add custom logic here
def filter_recipients(recipiant_list):
"""
Filters a list of recipient email addresses to exclude invalid or blacklisted emails.