From a9112c04804451967a91bc577498f61cbdf38075 Mon Sep 17 00:00:00 2001 From: Son NK Date: Fri, 6 Dec 2019 21:06:38 +0100 Subject: [PATCH] remove DKIM-Signature for custom domain --- email_handler.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/email_handler.py b/email_handler.py index cbd0bd8d..a54c2fdc 100644 --- a/email_handler.py +++ b/email_handler.py @@ -176,10 +176,20 @@ class MailHandler: return "550 wrong reply email" forward_email = ForwardEmail.get_by(reply_email=reply_email) - alias = forward_email.gen_email.email + alias: str = forward_email.gen_email.email notify_admin(f"Reply phase used by user: {forward_email.gen_email.user.email} ") + # todo: add DKIM-Signature for custom domain + # remove DKIM-Signature for custom domain + if not alias.endswith(EMAIL_DOMAIN) and msg["DKIM-Signature"]: + LOG.d( + "Remove DKIM-Signature %s for custom-domain alias %s", + msg["DKIM-Signature"], + alias, + ) + del msg["DKIM-Signature"] + # email seems to come from alias msg.replace_header("From", alias) msg.replace_header("To", forward_email.website_email)