From f95428a5ccff243e8134827bd4185f6aa7ad4efd Mon Sep 17 00:00:00 2001 From: Son Date: Tue, 2 Nov 2021 10:59:17 +0100 Subject: [PATCH] do not delete email log when email can't be sent to a contact --- email_handler.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/email_handler.py b/email_handler.py index fb39fabc..9525b543 100644 --- a/email_handler.py +++ b/email_handler.py @@ -1021,7 +1021,7 @@ def handle_reply(envelope, msg: Message, rcpt_to: str) -> (bool, str): LOG.e( "Cannot encrypt message %s -> %s. %s %s", alias, contact, mailbox, user ) - # to not save the email_log + # programming error, user shouldn't see a new email log EmailLog.delete(email_log.id) Session.commit() # return 421 so the client can retry later @@ -1081,9 +1081,6 @@ def handle_reply(envelope, msg: Message, rcpt_to: str) -> (bool, str): is_forward=False, ) except Exception: - # to not save the email_log - Session.rollback() - LOG.w("Cannot send email from %s to %s", alias, contact) send_email( mailbox.email,