Handle the case the msg is sent from the mailbox to alias. Happen when reply-all

This commit is contained in:
Son NK 2020-03-30 22:02:22 +02:00
parent ca5e3ac477
commit 33a80236d3
1 changed files with 7 additions and 0 deletions

View File

@ -417,6 +417,13 @@ def handle_forward(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> (bool, s
mailbox_email = mailbox.email
user = alias.user
# Sometimes when user clicks on "reply all"
# an email is sent to the same alias that the previous message is destined to
if envelope.mail_from == mailbox_email:
# nothing to do
LOG.d("Forward from %s to %s, nothing to do", envelope.mail_from, mailbox_email)
return False, "550 SL ignored"
# create PGP email if needed
if mailbox.pgp_finger_print and user.is_premium():
LOG.d("Encrypt message using mailbox %s", mailbox)