Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Add check for SES bounce notif type (#1123)

Haseeb Ahmad755344e74b85
diff --git a/internal/bounce/webhooks/ses.go b/internal/bounce/webhooks/ses.go
index 8ad252cd..02b423ce 100644
--- a/internal/bounce/webhooks/ses.go
+++ b/internal/bounce/webhooks/ses.go
@@ -46,6 +46,7 @@ type sesNotif struct {
type sesTimestamp time.Time
type sesMail struct {
+ EventType string `json:"eventType"`
NotifType string `json:"notificationType"`
Bounce struct {
BounceType string `json:"bounceType"`
@@ -118,6 +119,10 @@ func (s *SES) ProcessBounce(b []byte) (models.Bounce, error) {
return bounce, fmt.Errorf("error unmarshalling SES notification: %v", err)
}
+ if !(m.EventType == "Bounce" || m.NotifType == "Bounce") {
+ return bounce, errors.New("notification type is not bounce")
+ }
+
if len(m.Mail.Destination) == 0 {
return bounce, errors.New("no destination e-mails found in SES notification")
}