handle the case reply_email not exist

This commit is contained in:
Son NK 2020-02-02 18:53:26 +07:00
parent 0a9914a2a6
commit a2bbd49232
1 changed files with 5 additions and 1 deletions

View File

@ -294,10 +294,14 @@ class MailHandler:
# reply_email must end with EMAIL_DOMAIN
if not reply_email.endswith(EMAIL_DOMAIN):
LOG.error(f"Reply email {reply_email} has wrong domain")
LOG.warning(f"Reply email {reply_email} has wrong domain")
return "550 wrong reply email"
forward_email = ForwardEmail.get_by(reply_email=reply_email)
if not forward_email:
LOG.warning(f"No such forward-email with {reply_email} as reply-email")
return "550 wrong reply email"
alias: str = forward_email.gen_email.email
alias_domain = alias[alias.find("@") + 1 :]