From 84ba2ed71899fcbbf138c168aa5aaeeba2156858 Mon Sep 17 00:00:00 2001 From: Son NK Date: Tue, 17 Mar 2020 12:10:13 +0100 Subject: [PATCH] fix should_append_alias --- email_handler.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/email_handler.py b/email_handler.py index 43db2686..c618981e 100644 --- a/email_handler.py +++ b/email_handler.py @@ -246,12 +246,12 @@ def get_or_create_contact(website_from_header: str, alias: Alias) -> Contact: return contact -def should_append_alias(msg, alias): +def should_append_alias(msg: Message, address: str): """whether an alias should be appened to TO header in message""" - if msg["To"] and alias in msg["To"]: + if msg["To"] and address in msg["To"]: return False - if msg["Cc"] and alias in msg["Cc"]: + if msg["Cc"] and address in msg["Cc"]: return False return True @@ -339,7 +339,7 @@ def handle_forward(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> str: LOG.d("new from header:%s", from_header) # append alias into the TO header if it's not present in To or CC - if should_append_alias(msg, alias): + if should_append_alias(msg, alias.email): LOG.d("append alias %s to TO header %s", alias, msg["To"]) if msg["To"]: to_header = msg["To"] + "," + alias