From af89725d203ad302076f3d9a899bb263ac8b86ba Mon Sep 17 00:00:00 2001 From: mdecimus Date: Sat, 6 Jul 2024 11:14:03 +0200 Subject: [PATCH] Avoid sending reports for DMARC/delivery reports (closes #173) --- crates/smtp/src/inbound/data.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/smtp/src/inbound/data.rs b/crates/smtp/src/inbound/data.rs index c79d3f3f7..6c5d7ed1c 100644 --- a/crates/smtp/src/inbound/data.rs +++ b/crates/smtp/src/inbound/data.rs @@ -239,6 +239,7 @@ impl Session { } // Verify DMARC + let is_report = self.is_report(); let (dmarc_result, dmarc_policy) = match &self.data.spf_mail_from { Some(spf_output) if dmarc.verify() => { let dmarc_output = self @@ -301,7 +302,7 @@ impl Session { } // Send DMARC report - if dmarc_output.requested_reports() { + if dmarc_output.requested_reports() && !is_report { self.send_dmarc_report( &auth_message, &auth_results, @@ -330,7 +331,7 @@ impl Session { }; // Analyze reports - if self.is_report() { + if is_report { self.core.analyze_report(raw_message.clone()); if !rc.analysis.forward { self.data.messages_sent += 1;