Add check for SES bounce notif type (#1123)
This commit is contained in:
parent
8985e5c24a
commit
755344e74b
1 changed files with 5 additions and 0 deletions
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue