do not delete email log when email can't be sent to a contact

This commit is contained in:
Son 2021-11-02 10:59:17 +01:00
parent 542310f5ca
commit f95428a5cc
1 changed files with 1 additions and 4 deletions

View File

@ -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,