fix(outbound): count a missing mailbox only when RCPT TO says so

- Issue MAIL, RCPT and DATA one by one so a failure knows which command it answers
- Treat 5.1.1, 5.1.2, 5.1.3, 5.1.6 and 5.1.10 as 'no such mailbox' only in answer to RCPT TO
- A refused sender (5.1.x answering MAIL FROM) or a refusal after DATA keeps the delivery as failed and never strikes members
- Ignore a QUIT error once the relay accepted the message: it caused duplicate deliveries
This commit is contained in:
tgiachi 2026-11-10 11:37:45 +01:00
commit c1c8211c1b

View file

@ -179,8 +179,11 @@ It answers `451` only when the database itself fails.
- A permanent rejection of the message by the relay (5xx: policy, size, line length...) is never retried, but the
delivery is not made to vanish: it is kept as **failed**, with the reason, for a week (queue API, `parsimony queue ls`,
the Queue page; discard it to clear it). The same happens when a delivery is still failing after 3 days.
- A bad-mailbox reply (`5.1.x`, the address does not exist) drops the delivery and counts as a hard bounce for the
member (3 disable it). Other errors, such as "relay access denied", never disable members.
- A reply to `RCPT TO` that says the address does not exist (`5.1.1`, `5.1.2`, `5.1.3`, `5.1.6`, `5.1.10`) drops the
delivery and counts as a hard bounce for the member (3 disable it). Nothing else counts: not "relay access denied", not a
refused sender (`5.1.7`, `5.1.8`, or any code answering `MAIL FROM`), not a refusal after `DATA`. Those deliveries are kept
as failed.
- A relay that accepted the message is never asked again because `QUIT` went wrong.
- Delivery is at-least-once: a crash between the relay accepting a message and the queue entry being
removed can send one message to one recipient twice.
- `GET /api/v1/queue` and the Queue page show what is pending or failing, and a stuck delivery can be discarded.