From f7c1f69fb861408a56c4b9ec4b6dbc95e554f5a8 Mon Sep 17 00:00:00 2001 From: X-Ryl669 Date: Mon, 23 Mar 2020 14:21:45 +0100 Subject: [PATCH] Fix support for DKIM signing when forwarding and aliasing is enabled This partially fix #2774 --- plugins/aliases.js | 1 + plugins/dkim_sign.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/plugins/aliases.js b/plugins/aliases.js index 2b385e8ea..209fea63a 100644 --- a/plugins/aliases.js +++ b/plugins/aliases.js @@ -112,6 +112,7 @@ function _alias (plugin, connection, key, config, host) { connection.transaction.rcpt_to.pop(); connection.transaction.rcpt_to.push(toAddress); } + connection.transaction.notes.forward = true; } else { connection.loginfo(plugin, `alias failed for ${key}, no "to" field in alias config`); diff --git a/plugins/dkim_sign.js b/plugins/dkim_sign.js index 662d0512d..9523f7e4c 100644 --- a/plugins/dkim_sign.js +++ b/plugins/dkim_sign.js @@ -355,6 +355,8 @@ exports.get_sender_domain = function (connection) { } } + // In case of forwarding, only use the Envelope + if (txn.notes.forward) return domain; if (!txn.header) return domain; // the DKIM signing key should be aligned with the domain in the From