If there is no transactional id, skip it (#2047)
This commit is contained in:
parent
76423527dd
commit
565f6dc142
|
@ -1892,23 +1892,24 @@ def handle_transactional_bounce(
|
||||||
):
|
):
|
||||||
LOG.d("handle transactional bounce sent to %s", rcpt_to)
|
LOG.d("handle transactional bounce sent to %s", rcpt_to)
|
||||||
|
|
||||||
# parse the TransactionalEmail
|
|
||||||
transactional_id = transactional_id or parse_id_from_bounce(rcpt_to)
|
|
||||||
transactional = TransactionalEmail.get(transactional_id)
|
transactional = TransactionalEmail.get(transactional_id)
|
||||||
|
|
||||||
# a transaction might have been deleted in delete_logs()
|
# a transaction might have been deleted in delete_logs()
|
||||||
if transactional:
|
if not transactional:
|
||||||
LOG.i("Create bounce for %s", transactional.email)
|
LOG.i(
|
||||||
bounce_info = get_mailbox_bounce_info(msg)
|
f"No transactional record for {envelope.mail_from} -> {envelope.rcpt_tos}"
|
||||||
if bounce_info:
|
)
|
||||||
Bounce.create(
|
return
|
||||||
email=transactional.email,
|
LOG.i("Create bounce for %s", transactional.email)
|
||||||
info=bounce_info.as_bytes().decode(),
|
bounce_info = get_mailbox_bounce_info(msg)
|
||||||
commit=True,
|
if bounce_info:
|
||||||
)
|
Bounce.create(
|
||||||
else:
|
email=transactional.email,
|
||||||
LOG.w("cannot get bounce info, debug at %s", save_email_for_debugging(msg))
|
info=bounce_info.as_bytes().decode(),
|
||||||
Bounce.create(email=transactional.email, commit=True)
|
commit=True,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
LOG.w("cannot get bounce info, debug at %s", save_email_for_debugging(msg))
|
||||||
|
Bounce.create(email=transactional.email, commit=True)
|
||||||
|
|
||||||
|
|
||||||
def handle_bounce(envelope, email_log: EmailLog, msg: Message) -> str:
|
def handle_bounce(envelope, email_log: EmailLog, msg: Message) -> str:
|
||||||
|
|
Loading…
Reference in New Issue