do not forward to unverified mailbox

This commit is contained in:
Son NK 2020-09-10 09:38:30 +02:00
parent a660a05f83
commit e6dd2f1717
1 changed files with 23 additions and 8 deletions

View File

@ -482,6 +482,10 @@ async def handle_forward(
# no need to create a copy of message
if len(mailboxes) == 1:
mailbox = mailboxes[0]
if not mailbox.verified:
LOG.debug("Mailbox %s unverified, do not forward", mailbox)
return [(False, "550 SL E18 unverified mailbox")]
else:
ret.append(
await forward_email_to_mailbox(
alias, msg, email_log, contact, envelope, smtp, mailbox, user
@ -490,9 +494,20 @@ async def handle_forward(
# create a copy of message for each forward
else:
for mailbox in mailboxes:
if not mailbox.verified:
LOG.debug("Mailbox %s unverified, do not forward", mailbox)
ret.append((False, "550 SL E19 unverified mailbox"))
else:
ret.append(
await forward_email_to_mailbox(
alias, copy(msg), email_log, contact, envelope, smtp, mailbox, user
alias,
copy(msg),
email_log,
contact,
envelope,
smtp,
mailbox,
user,
)
)