handle case where alias mailbox is invalid
This commit is contained in:
parent
171100eda7
commit
8079746e47
|
@ -422,8 +422,9 @@ def handle_email_sent_to_ourself(alias, mailbox, msg: Message, user):
|
||||||
async def handle_forward(
|
async def handle_forward(
|
||||||
envelope, smtp: SMTP, msg: Message, rcpt_to: str
|
envelope, smtp: SMTP, msg: Message, rcpt_to: str
|
||||||
) -> List[Tuple[bool, str]]:
|
) -> List[Tuple[bool, str]]:
|
||||||
"""return whether an email has been delivered and
|
"""return an array of SMTP status (is_success, smtp_status)
|
||||||
the smtp status ("250 Message accepted", "550 Non-existent email address", etc)
|
is_success indicates whether an email has been delivered and
|
||||||
|
smtp_status is the SMTP Status ("250 Message accepted", "550 Non-existent email address", etc)
|
||||||
"""
|
"""
|
||||||
address = rcpt_to.lower().strip() # alias@SL
|
address = rcpt_to.lower().strip() # alias@SL
|
||||||
|
|
||||||
|
@ -459,6 +460,11 @@ async def handle_forward(
|
||||||
|
|
||||||
ret = []
|
ret = []
|
||||||
mailboxes = alias.mailboxes
|
mailboxes = alias.mailboxes
|
||||||
|
|
||||||
|
# no valid mailbox
|
||||||
|
if not mailboxes:
|
||||||
|
return [(False, "550 SL E16 invalid mailbox")]
|
||||||
|
|
||||||
# no need to create a copy of message
|
# no need to create a copy of message
|
||||||
if len(mailboxes) == 1:
|
if len(mailboxes) == 1:
|
||||||
mailbox = mailboxes[0]
|
mailbox = mailboxes[0]
|
||||||
|
|
Loading…
Reference in New Issue