From de0f8389506656fc2a44fc9e3f44886bad71f90c Mon Sep 17 00:00:00 2001 From: Son Date: Mon, 25 Oct 2021 10:36:50 +0200 Subject: [PATCH] ignore hotmail bounce that uses 'Undisclosed recipients:;' in :To header --- email_handler.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/email_handler.py b/email_handler.py index 5d3245e0..3ec9edd8 100644 --- a/email_handler.py +++ b/email_handler.py @@ -1373,7 +1373,13 @@ def handle_hotmail_complaint(msg: Message) -> bool: LOG.e("cannot find the alias") return False - _, alias_address = parse_full_address(get_header_unicode(to_header)) + try: + _, alias_address = parse_full_address(get_header_unicode(to_header)) + except ValueError: + # to_header can be something like 'Undisclosed recipients:;' + LOG.w("cannot parse %s", to_header) + return False + alias = Alias.get_by(email=alias_address) if not alias: