Skip to content

Commit

Permalink
fix: blacklisting bug
Browse files Browse the repository at this point in the history
  • Loading branch information
KishenKumarrrrr committed Sep 19, 2023
1 parent 943315d commit 632142d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions backend/src/email/utils/callback/parsers/ses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,15 @@ const blacklistIfNeeded = async (message: any): Promise<void> => {
const bounceType = message?.bounce?.bounceType
const complaintType = message?.complaint?.complaintFeedbackType

const recipients = message?.mail?.commonHeaders?.to
const recipientsToBlacklist = message.bounce?.bouncedRecipients?.map(
(e: any) => e.emailAddress
)
if (
notificationType &&
recipients &&
recipientsToBlacklist &&
shouldBlacklist({ notificationType, bounceType, complaintType })
) {
await Promise.all(recipients.map(addToBlacklist))
await Promise.all(recipientsToBlacklist.map(addToBlacklist))
}
}
const parseRecord = async (record: SesRecord): Promise<void> => {
Expand Down

0 comments on commit 632142d

Please sign in to comment.