Skip to content

Commit

Permalink
fix(tempfail-as-default): ZMS-183 (#28)
Browse files Browse the repository at this point in the history
* in case of Zilter tempfail show error

* default to tempfail
  • Loading branch information
NickOvt authored Oct 28, 2024
1 parent 08147c8 commit 0ba0723
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ module.exports.init = async app => {
const messageSize = envelope.headers.build().length + envelope.bodySize; // RFC822 size (size of Headers + Body)

let passEmail = true;
let isTempFail = false;
let isTempFail = true;

const messageHeadersList = [];

Expand Down Expand Up @@ -238,8 +238,8 @@ module.exports.init = async app => {
}

if (resBodyJson.action && resBodyJson.action !== 'accept') {
if (resBodyJson.action === 'tempfail') {
isTempFail = true;
if (resBodyJson.action !== 'tempfail') {
isTempFail = false;
}

// not accepted
Expand Down Expand Up @@ -297,12 +297,13 @@ module.exports.init = async app => {

if (!passEmail) {
// rejected
if (isTempFail) {
throw app.reject(envelope, 'tempfail', messageinfo, 'Temporary error, please try again later.');
}
throw app.reject(envelope, 'banned', messageinfo, '550 SMTP ACCESS DENIED - ABUSE PREVENTION HAS TRIGGERED A BAN.');
}

if (isTempFail) {
throw app.reject(envelope, 'tempfail', messageinfo, 'Temporary error, please try again later.');
}

return;
});
};

0 comments on commit 0ba0723

Please sign in to comment.