From 201eb3b9b9575894615a76c5c244ae73c276ebdb Mon Sep 17 00:00:00 2001 From: Son Nguyen Kim Date: Wed, 8 Sep 2021 11:02:35 +0200 Subject: [PATCH] fix handle_hotmail_complaint: handle email format with name --- email_handler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/email_handler.py b/email_handler.py index 08ef4d84..177b1458 100644 --- a/email_handler.py +++ b/email_handler.py @@ -1287,11 +1287,13 @@ def handle_hotmail_complaint(msg: Message): Handle hotmail complaint sent to postmaster """ orig_msg = get_orig_message_from_outlook_complaint(msg) - alias_address = orig_msg["To"] + to_header = orig_msg["To"] + _, alias_address = parseaddr_unicode(to_header) alias = Alias.get_by(email=alias_address) if not alias: LOG.d("No alias for %s", alias_address) + return user = alias.user LOG.e("Handle hotmail complaint for %s %s", alias, user)