diff --git a/app/email/status.py b/app/email/status.py index 82e30821..849cf425 100644 --- a/app/email/status.py +++ b/app/email/status.py @@ -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 " diff --git a/email_handler.py b/email_handler.py index 5cf77ff5..0ec1a620 100644 --- a/email_handler.py +++ b/email_handler.py @@ -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: