update to backend.py and utils.py to suport changes in signals.py
This commit is contained in:
parent
c0b71c4060
commit
f49706a476
|
@ -242,6 +242,7 @@ class SESBackend(BaseEmailBackend):
|
||||||
f"message_id={message.extra_headers['message_id']}, request_id={message.extra_headers['request_id']}"
|
f"message_id={message.extra_headers['message_id']}, request_id={message.extra_headers['request_id']}"
|
||||||
)
|
)
|
||||||
list_of_response.append(response)
|
list_of_response.append(response)
|
||||||
|
signals.email_post_send.send_robust(self.__class__, message=message)
|
||||||
except ResponseError as err:
|
except ResponseError as err:
|
||||||
logger.error(f"Failed to send email: {err}")
|
logger.error(f"Failed to send email: {err}")
|
||||||
message.extra_headers.update({
|
message.extra_headers.update({
|
||||||
|
|
|
@ -212,6 +212,13 @@ def receiver_email_pre_send(sender, message=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
pass
|
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):
|
def filter_recipients(recipiant_list):
|
||||||
"""
|
"""
|
||||||
Filters a list of recipient email addresses to exclude invalid or blacklisted emails.
|
Filters a list of recipient email addresses to exclude invalid or blacklisted emails.
|
||||||
|
|
Loading…
Reference in New Issue