From a4dbbb6ac26ac18d2c7795c09e9fb42eb971539a Mon Sep 17 00:00:00 2001 From: Son Date: Thu, 28 Oct 2021 10:19:58 +0200 Subject: [PATCH] if contact is blocked, do not forward email --- email_handler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/email_handler.py b/email_handler.py index f088b596..581aa854 100644 --- a/email_handler.py +++ b/email_handler.py @@ -564,7 +564,7 @@ def handle_forward(envelope, msg: Message, rcpt_to: str) -> List[Tuple[bool, str else: reply_to_contact = get_or_create_reply_to_contact(reply_to, alias) - if not alias.enabled: + if not alias.enabled or contact.block_forward: LOG.d("%s is disabled, do not forward", alias) EmailLog.create( contact_id=contact.id, @@ -574,7 +574,7 @@ def handle_forward(envelope, msg: Message, rcpt_to: str) -> List[Tuple[bool, str commit=True, ) Session.commit() - # do not return 5** to allow user to receive emails later when alias is enabled + # do not return 5** to allow user to receive emails later when alias is enabled or contact is unblocked return [(True, status.E200)] ret = []