From 7e53b97f8196fb6e5af3bc2881e342c213a1cde7 Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Mon, 4 Jan 2021 19:25:15 +0100 Subject: [PATCH] handle the case where alias is deleted in handle_bounce_reply_phase() --- email_handler.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/email_handler.py b/email_handler.py index 5ed8df5d..630e24c3 100644 --- a/email_handler.py +++ b/email_handler.py @@ -1271,6 +1271,11 @@ def handle_bounce_reply_phase(msg: Message, rcpt_to: str): Happens when an email cannot be sent from an alias to a contact """ alias = Alias.get_by(email=rcpt_to) + # the alias has been deleted in the meantime + if not alias: + LOG.warning("No such alias for %s", rcpt_to) + return + user = alias.user try: