From ff2cbeb3af85dda4574ba53448e15e6ba09aece5 Mon Sep 17 00:00:00 2001 From: Son Nguyen Kim Date: Wed, 8 Sep 2021 15:49:47 +0200 Subject: [PATCH] handle case to header isn't present --- email_handler.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/email_handler.py b/email_handler.py index f1b8d8f0..9c57b4b5 100644 --- a/email_handler.py +++ b/email_handler.py @@ -1288,6 +1288,11 @@ def handle_hotmail_complaint(msg: Message): """ orig_msg = get_orig_message_from_outlook_complaint(msg) to_header = orig_msg["To"] + if not to_header: + LOG.e("cannot find the alias") + LOG.d("msg:%s, \n orig_msg:%s", msg, orig_msg) + return + _, alias_address = parseaddr_unicode(to_header) alias = Alias.get_by(email=alias_address)