refactor handle_forward: move the disabled alias case to the beginning
This commit is contained in:
parent
b5e7f05bfc
commit
59036972f1
|
@ -324,10 +324,6 @@ def handle_forward(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> (bool, s
|
|||
LOG.d("alias %s cannot be created on-the-fly, return 550", address)
|
||||
return False, "550 SL E3"
|
||||
|
||||
mailbox = alias.mailbox
|
||||
mailbox_email = mailbox.email
|
||||
user = alias.user
|
||||
|
||||
contact = get_or_create_contact(msg["From"], alias)
|
||||
email_log = EmailLog.create(contact_id=contact.id, user_id=contact.user_id)
|
||||
|
||||
|
@ -336,8 +332,13 @@ def handle_forward(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> (bool, s
|
|||
email_log.blocked = True
|
||||
|
||||
db.session.commit()
|
||||
# do not return 5** to allow user to receive emails later when alias is enabled
|
||||
return True, "250 Message accepted for delivery"
|
||||
|
||||
mailbox = alias.mailbox
|
||||
mailbox_email = mailbox.email
|
||||
user = alias.user
|
||||
|
||||
spam_check = True
|
||||
|
||||
# create PGP email if needed
|
||||
|
|
Loading…
Reference in a new issue