From f0d8e2c8a4a3d030806f1321feff6e64f1b639d4 Mon Sep 17 00:00:00 2001 From: Raymond Jessop Date: Fri, 18 Apr 2025 14:59:34 -0500 Subject: [PATCH] updates to signals.py --- django_aws_ses/signals.py | 53 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/django_aws_ses/signals.py b/django_aws_ses/signals.py index 47ea1a1..2a8c574 100644 --- a/django_aws_ses/signals.py +++ b/django_aws_ses/signals.py @@ -1,8 +1,59 @@ from django.dispatch import Signal -# The following fields are used from the 3 signals below: mail_obj, bounce_obj, raw_message +# Exported signals +__all__ = ( + 'bounce_received', + 'complaint_received', + 'delivery_received', + 'email_pre_send', + 'email_post_send', +) + bounce_received = Signal() +"""Signal sent when an AWS SES bounce notification is received. + +Args: + sender: The view or function handling the bounce (e.g., handle_bounce). + mail_obj (dict): SES mail object containing email details. + bounce_obj (dict): SES bounce details (e.g., bounceType, feedbackId). + raw_message (bytes): Raw SNS notification payload. +""" + complaint_received = Signal() +"""Signal sent when an AWS SES complaint notification is received. + +Args: + sender: The view or function handling the complaint (e.g., handle_bounce). + mail_obj (dict): SES mail object containing email details. + complaint_obj (dict): SES complaint details (e.g., feedbackType, feedbackId). + raw_message (bytes): Raw SNS notification payload. +""" + delivery_received = Signal() +"""Signal sent when an AWS SES delivery or send notification is received. + +Args: + sender: The view or function handling the delivery (e.g., handle_bounce). + mail_obj (dict): SES mail object containing email details. + delivery_obj (dict): SES delivery details (e.g., messageId, destination). + raw_message (bytes): Raw SNS notification payload. +""" + email_pre_send = Signal() +"""Signal sent before an email is sent via SES. + +Args: + sender: The SESBackend class. + message (EmailMessage): The Django EmailMessage object to be sent. +""" + email_post_send = Signal() +"""Signal sent after an email is sent via SES. + +Args: + sender: The SESBackend class. + message (EmailMessage): The Django EmailMessage object sent. + +Note: + This signal is reserved for future functionality to handle post-send processing. +""" \ No newline at end of file