From bda2c62e58006efd01551b4ed5c21524ed4539c7 Mon Sep 17 00:00:00 2001 From: ralf Date: Wed, 13 Nov 2024 19:54:01 +0100 Subject: [PATCH] remove DKIM-Signature before forward, as we change From, and restore it after --- api/src/Mail/Script.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/src/Mail/Script.php b/api/src/Mail/Script.php index 763f57352b..0923bce476 100644 --- a/api/src/Mail/Script.php +++ b/api/src/Mail/Script.php @@ -411,6 +411,9 @@ class Script // we need to delete From header, to be able to overwrite it! $newruletext .= "\t".'deleteheader "from";'."\n"; $newruletext .= "\t".'addheader "From" "\'${from}\' <${user_email}>";'."\n\n"; + // we need to delete the DKIM-Signature header, as we change the from + $newruletext .= 'if header :matches "DKIM-Signature" "*" { set "dkim_signature" "${1}"; }'."\n"; + $newruletext .= "\t".'deleteheader "dkim-signature";'."\n"; } foreach(preg_split('/, ?/',$rule['action_arg']) as $addr) @@ -422,6 +425,8 @@ class Script // we restore the From header, in case we keep the mail, or other rules $newruletext .= "\n\t".'deleteheader "from";'."\n"; $newruletext .= "\t".'addheader "From" "${from_header}";'."\n"; + // we restore the DKIM-Signature header + $newruletext .= "\t".'addheader "DKIM-Signature" "${dkim_signature}";'."\n"; } } if (preg_match("/discard/i",$rule['action'])) {