[pmg-devel] [PATCH pmg-api] quarantine: delete Delivered-To and Return-Path when reinjecting

Stoiko Ivanov s.ivanov at proxmox.com
Mon Mar 27 21:18:13 CEST 2023


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 <s.ivanov at proxmox.com>
---
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





More information about the pmg-devel mailing list