Skip to content

Commit

Permalink
fix: fix spam check (clean up later)
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Feb 27, 2025
1 parent 343b4ce commit 50602da
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions helpers/get-bounce-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function getBounceInfo(err) {
// set bounce info on the error object (useful for debugging)
const response =
typeof err.response === 'string' ? err.response : err.message;
const lc = response.toLowerCase();
const bounceInfo = zoneMTABounces.check(response);
if (typeof bounceInfo.category !== 'string') bounceInfo.category = 'other';
if (bounceInfo.category === 'blacklist') bounceInfo.category = 'blocklist';
Expand All @@ -64,9 +65,12 @@ function getBounceInfo(err) {
) {
if (REGEX_VIRUS.test(response)) bounceInfo.category = 'virus';
else if (
// TODO: clean this up later or remove altogether
REGEX_SPAM.test(response) ||
response.toLowerCase() === 'spam' ||
response.toLowerCase() === 'spam.'
lc === 'spam' ||
lc === 'spam.' ||
lc.endsWith(' spam') ||
lc.endsWith(' spam.')
)
bounceInfo.category = 'spam';
}
Expand Down Expand Up @@ -203,10 +207,7 @@ function getBounceInfo(err) {
} else {
bounceInfo.category = 'spam';
}
} else if (
response.toLowerCase().includes('access denied') &&
response.includes(IP_ADDRESS)
) {
} else if (lc.includes('access denied') && response.includes(IP_ADDRESS)) {
bounceInfo.category = 'blocklist';
} else if (
//
Expand Down

0 comments on commit 50602da

Please sign in to comment.