Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(outbound): hook_delivered may contain an IP, so.. #3413

Merged
merged 3 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

### Unreleased

- fix(outbound): in outbound hook_delivered, when mx.exchange contains
an IP, use mx.from_dns
- fix(bin/haraka): fix for finding path to config/docs/Plugins.md

### [3.0.5] - 2024-09-27
Expand Down
9 changes: 8 additions & 1 deletion outbound/hmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const events = require('node:events');
const fs = require('node:fs');
const dns = require('node:dns');
const net = require('node:net');
const path = require('node:path');

const { Address } = require('address-rfc2821');
Expand Down Expand Up @@ -596,7 +597,13 @@ class HMailItem extends events.EventEmitter {
processing_mail = false;
if (success) {
const reason = response.join(' ');
self.delivered(host, port, (mx.using_lmtp ? 'LMTP' : 'SMTP'), mx.exchange,

let hostname = mx.exchange
if (net.isIP(hostname) && mx.from_dns && !net.isIP(mx.from_dns)) {
hostname = mx.from_dns
}

self.delivered(host, port, (mx.using_lmtp ? 'LMTP' : 'SMTP'), hostname,
reason, ok_recips, fail_recips, bounce_recips, secured, authenticated);
}
else {
Expand Down
Loading