Skip to content

Commit

Permalink
Merge pull request #2 from BOOKATIGER/detection-spec-minor-fixes
Browse files Browse the repository at this point in the history
Minor fixes for BoxTrapper and CPanel MTAs according to detection document
  • Loading branch information
araujoigor authored Feb 26, 2018
2 parents 250d2d9 + 821ab42 commit 793e62c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ module.exports = (headers) => {
if ('return-path' in headers && headers['return-path'] === '<>') {
return true;
}
if (headers['preference'] === 'auto_reply' || headers['preference'] === 'bulk' || headers['x-preference'] === 'auto_reply' || 'x-autorespond' in headers) {
if ('preference' in headers && headers['preference'].toLowerCase() === 'auto_reply') {
return true;
}
if ('x-precedence' in headers && headers['x-precedence'].toLowerCase() === 'auto_reply') {
return true;
}
if ('x-autorespond' in headers) {
return true;
}
if ('x-autogenerated' in headers && ['forward', 'group', 'letter', 'mirror', 'redirect', 'reply'].includes(headers['x-autogenerated'].toLowerCase())) {
Expand Down
6 changes: 3 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ assert.ok(isAutoreply({ 'return-path': '<>' }));
assert.ok(isAutoreply({ 'Preference': 'auto_reply' }));
assert.ok(isAutoreply({ 'preference': 'auto_reply' }));
assert.ok(!isAutoreply({ 'Preference': 'not_auto_reply' }));
assert.ok(isAutoreply({ 'X-Preference': 'auto_reply' }));
assert.ok(isAutoreply({ 'x-preference': 'auto_reply' }));
assert.ok(!isAutoreply({ 'X-Preference': 'not_auto_reply' }));
assert.ok(isAutoreply({ 'X-Precedence': 'auto_reply' }));
assert.ok(isAutoreply({ 'x-precedence': 'auto_reply' }));
assert.ok(!isAutoreply({ 'X-Precedence': 'not_auto_reply' }));

// Test X-AutoRepsond header
assert.ok(isAutoreply({ 'X-AutoRespond': '' }));
Expand Down

0 comments on commit 793e62c

Please sign in to comment.