From 2a1d7358007b91b4a1a1cac1c9fb7c6a3e0242d9 Mon Sep 17 00:00:00 2001 From: Son Date: Fri, 7 Jan 2022 16:22:35 +0100 Subject: [PATCH] always ignore loop email --- email_handler.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/email_handler.py b/email_handler.py index 298712f7..2c026c74 100644 --- a/email_handler.py +++ b/email_handler.py @@ -556,14 +556,14 @@ def handle_forward(envelope, msg: Message, rcpt_to: str) -> List[Tuple[bool, str else: return [(False, status.E504)] - if user.ignore_loop_email: - mail_from = envelope.mail_from - for mb in alias.mailboxes: - # email sent from a mailbox to its alias - if mb.email == mail_from: - LOG.w("cycle email sent from %s to %s", mb, alias) - handle_email_sent_to_ourself(alias, mb, msg, user) - return [(True, status.E209)] + # check if email is sent from alias's owning mailbox(es) + mail_from = envelope.mail_from + for mb in alias.mailboxes: + # email sent from a mailbox to its alias + if mb.email == mail_from: + LOG.i("cycle email sent from %s to %s", mb, alias) + handle_email_sent_to_ourself(alias, mb, msg, user) + return [(True, status.E209)] from_header = get_header_unicode(msg[headers.FROM]) LOG.d("Create or get contact for from_header:%s", from_header)