From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 5B6FF91E26 for ; Mon, 27 Mar 2023 21:19:06 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3E14A18470 for ; Mon, 27 Mar 2023 21:18:36 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 27 Mar 2023 21:18:35 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id EB75D46F83 for ; Mon, 27 Mar 2023 21:18:34 +0200 (CEST) From: Stoiko Ivanov To: pmg-devel@lists.proxmox.com Date: Mon, 27 Mar 2023 21:18:13 +0200 Message-Id: <20230327191813.189233-1-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.096 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pmg-devel] [PATCH pmg-api] quarantine: delete Delivered-To and Return-Path when reinjecting X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Mar 2023 19:19:06 -0000 The removal of those 2 headers was dropped in the recent rework for quarantine delivery. Leading to mails from quarantine being bounced by postfix 'local' delivery agent (as the comment in the original code stated) Reproduced by delivering a mail from quarantine to a postfix instance, which routes it to a local account Fixes: e51fe74 ("quarantine: use reinject_local_mail to deliver quarantined mail") Signed-off-by: Stoiko Ivanov --- noticed while testing if the OCR detection of SpamAssassin actually works Huge Thanks to Martin for suggesting the test! src/PMG/Quarantine.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/PMG/Quarantine.pm b/src/PMG/Quarantine.pm index bd5e63b..b80a5a3 100644 --- a/src/PMG/Quarantine.pm +++ b/src/PMG/Quarantine.pm @@ -108,6 +108,11 @@ sub deliver_quarantined_mail { my $entity = $parser->parse_open("$path"); PMG::MIMEUtils::fixup_multipart($entity); + # delete Delivered-To and Return-Path (avoid problem with postfix + # forwarding loop detection (man local)) + $entity->head->delete('Delivered-To'); + $entity->head->delete('Return-Path'); + my $sender = 'postmaster'; # notify postmaster if something fails eval { -- 2.30.2