Skip to content

Commit

Permalink
Update hmail.js
Browse files Browse the repository at this point in the history
  • Loading branch information
analogic authored Jun 4, 2024
1 parent c4ee966 commit 6c3cc14
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions outbound/hmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class HMailItem extends events.EventEmitter {
plugins.run_hooks('get_mx', this, domain);
}

get_mx_respond (retval, mx) {
async get_mx_respond (retval, mx) {
switch (retval) {
case constants.ok: {
this.logdebug(`MX from Plugin: ${this.todo.domain} => 0 ${JSON.stringify(mx)}`);
Expand Down Expand Up @@ -220,18 +220,21 @@ class HMailItem extends events.EventEmitter {
}

// none of the above return codes, drop through to DNS
net_utils.get_mx(this.todo.domain).then(exchanges => {
try {
let exchanges = await net_utils.get_mx(this.todo.domain);

Check failure on line 224 in outbound/hmail.js

View workflow job for this annotation

GitHub Actions / lint / lint

'exchanges' is never reassigned. Use 'const' instead

if (exchanges.length) {
this.found_mx(this.sort_mx(exchanges))
}
else {
for (const rcpt of this.todo.rcpt_to) {
this.extend_rcpt_with_dsn(rcpt, DSN.addr_bad_dest_system(`Nowhere to deliver mail to for domain: ${this.todo.domain}`));
this.extend_rcpt_with_dsn(rcpt, DSN.addr_bad_dest_system(`Nowhere to deliver mail to for domain: ${this.todo.domain}`))
}
this.bounce(`Nowhere to deliver mail to for domain: ${this.todo.domain}`);
}
})
.catch(this.get_mx_err)
} catch (e) {
this.get_mx_error(e);
}
}

get_mx_error (err) {
Expand Down

0 comments on commit 6c3cc14

Please sign in to comment.