return 250 status when handling bounces

This commit is contained in:
Son 2021-11-13 11:21:19 +01:00
parent 324cc8734b
commit 790f0ed23c
2 changed files with 5 additions and 5 deletions

View File

@ -16,6 +16,8 @@ E208 = "250 SL E208 Hotmail complaint handled"
E209 = "250 SL E209 Email Loop"
E210 = "250 SL E210 Yahoo complaint handled"
E211 = "250 SL E211 Bounce Forward phase handled"
E212 = "250 SL E212 Bounce Reply phase handled"
# 4** errors
# E401 = "421 SL E401 Retry later"
@ -38,14 +40,12 @@ E509 = "550 SL E509 unauthorized"
E510 = "550 SL E510 so such user"
E511 = "550 SL E511 unsubscribe error"
E512 = "550 SL E512 No such email log"
E513 = "550 SL E513 Email cannot be forwarded to mailbox"
E514 = "550 SL E514 Email sent to noreply address"
E515 = "550 SL E515 Email not exist"
E516 = "550 SL E516 invalid mailbox"
E517 = "550 SL E517 unverified mailbox"
E518 = "550 SL E518 Disabled mailbox"
E519 = "550 SL E519 Email detected as spam"
E520 = "550 SL E520 Email cannot be sent to contact"
E521 = "550 SL E521 Cannot reach mailbox"
E522 = (
"550 SL E522 The user you are trying to contact is receiving mail "

View File

@ -1561,7 +1561,6 @@ def handle_bounce_reply_phase(envelope, msg: Message, email_log: EmailLog):
refused_email_url=refused_email_url,
),
)
return status.E520
def handle_spam(
@ -1855,10 +1854,11 @@ def handle_bounce(envelope, email_log: EmailLog, msg: Message) -> str:
# Failed delivery for all, return the first failure
return res[0][1]
return handle_bounce_reply_phase(envelope, msg, email_log)
handle_bounce_reply_phase(envelope, msg, email_log)
return status.E212
else: # forward phase
handle_bounce_forward_phase(msg, email_log)
return status.E513
return status.E211
def should_ignore(mail_from: str, rcpt_tos: List[str]) -> bool: