delete email_log if CannotCreateContactForReverseAlias
This commit is contained in:
parent
01ba5e8bf0
commit
b23f9fa971
|
@ -812,8 +812,14 @@ def forward_email_to_mailbox(
|
||||||
LOG.d("Reply-To header, new:%s, old:%s", new_reply_to_header, reply_to_header)
|
LOG.d("Reply-To header, new:%s, old:%s", new_reply_to_header, reply_to_header)
|
||||||
|
|
||||||
# replace CC & To emails by reverse-alias for all emails that are not alias
|
# replace CC & To emails by reverse-alias for all emails that are not alias
|
||||||
|
try:
|
||||||
replace_header_when_forward(msg, alias, "Cc")
|
replace_header_when_forward(msg, alias, "Cc")
|
||||||
replace_header_when_forward(msg, alias, "To")
|
replace_header_when_forward(msg, alias, "To")
|
||||||
|
except CannotCreateContactForReverseAlias:
|
||||||
|
LOG.d("CannotCreateContactForReverseAlias error, delete %s", email_log)
|
||||||
|
EmailLog.delete(email_log.id)
|
||||||
|
Session.commit()
|
||||||
|
raise
|
||||||
|
|
||||||
# add List-Unsubscribe header
|
# add List-Unsubscribe header
|
||||||
if user.one_click_unsubscribe_block_sender:
|
if user.one_click_unsubscribe_block_sender:
|
||||||
|
@ -2349,7 +2355,6 @@ class MailHandler:
|
||||||
msg[headers.FROM],
|
msg[headers.FROM],
|
||||||
msg[headers.TO],
|
msg[headers.TO],
|
||||||
)
|
)
|
||||||
Session.rollback()
|
|
||||||
return status.E524
|
return status.E524
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.e(
|
LOG.e(
|
||||||
|
|
Loading…
Reference in a new issue