From aa2556621e950dc1ea834c66f1f6b94eabb39950 Mon Sep 17 00:00:00 2001 From: Maurus Decimus <11444311+mdecimus@users.noreply.github.com> Date: Sun, 10 May 2026 10:57:57 +0200 Subject: [PATCH] Fix MTA: Process reports using original `RCPT` before rewriting. --- CHANGELOG.md | 1 + crates/smtp/src/reporting/inbound.rs | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00da9537..6f00e901 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ If you are upgrading from v0.16.x, replace the binary (or run `docker pull`). If - ACME: - Include apex domains when requesting certificates for subdomains. - Use the public suffix list to determine the zone name when no origin is provided. +- MTA: Process reports using original `RCPT` before rewriting. ## [0.16.4] - 2026-05-05 diff --git a/crates/smtp/src/reporting/inbound.rs b/crates/smtp/src/reporting/inbound.rs index 98af3361..2b4051af 100644 --- a/crates/smtp/src/reporting/inbound.rs +++ b/crates/smtp/src/reporting/inbound.rs @@ -38,14 +38,20 @@ impl Session { pub fn is_report(&self) -> bool { for addr_match in &self.server.core.smtp.report.analysis.addresses { for addr in &self.data.rcpt_to { + let rcpt_addr = addr + .dsn_info + .as_ref() + .and_then(|v| v.strip_prefix("rfc822;")) + .unwrap_or(&addr.address_lcase); + match addr_match { - AddressMatch::StartsWith(prefix) if addr.address_lcase.starts_with(prefix) => { + AddressMatch::StartsWith(prefix) if rcpt_addr.starts_with(prefix) => { return true; } - AddressMatch::EndsWith(suffix) if addr.address_lcase.ends_with(suffix) => { + AddressMatch::EndsWith(suffix) if rcpt_addr.ends_with(suffix) => { return true; } - AddressMatch::Equals(value) if addr.address_lcase.eq(value) => return true, + AddressMatch::Equals(value) if rcpt_addr.eq(value) => return true, _ => (), } }