handle the case where alias is deleted in handle_bounce_reply_phase()

This commit is contained in:
Son NK 2021-01-04 19:25:15 +01:00
parent 271734f5e2
commit 7e53b97f81
1 changed files with 5 additions and 0 deletions

View File

@ -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: