Browse Source

return 550 instead of 510 when alias not exist

Son NK 5 years ago
parent
commit
9afcae534b
1 changed files with 3 additions and 3 deletions
  1. 3 3
      email_handler.py

+ 3 - 3
email_handler.py

@@ -300,11 +300,11 @@ def handle_forward(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> str:
 
     alias = Alias.get_by(email=address)
     if not alias:
-        LOG.d("alias %s not exist. Try to see if it can be created on the fly", alias)
+        LOG.d("alias %s not exist. Try to see if it can be created on the fly", address)
         alias = try_auto_create(address)
         if not alias:
-            LOG.d("alias %s cannot be created on-the-fly, return 510", address)
-            return "510 Email not exist"
+            LOG.d("alias %s cannot be created on-the-fly, return 550", address)
+            return "550 SL Email not exist"
 
     mailbox = alias.mailbox
     mailbox_email = mailbox.email