Karta. Bounces
(Karta v1.0.0)
Bounces: the delivery failures that come back to the VERP return path
(Karta.Outbound.ReturnPath) after Karta has sent a message.
ingest/3 reads a notification (Karta.Bounces.DSN), matches it to the
recipient the return path names, records it (Karta.Bounces.Bounce),
records the outcome as a delivery attempt (Karta.Outbound.Delivery),
emits the webhook event of that outcome (message.bounced or
message.deferred, in every format) and, for a permanent failure,
suppresses the address (Karta.Suppressions).
The recipient's state is written for a permanent failure only: Karta
does not retry a message its receiving server has already reported on,
and turning a delivered recipient back to :deferred could make a
running delivery job send it again. A temporary failure is recorded in
the delivery and the bounce, and the recipient keeps the state Karta's
own attempts gave it.
A hard bounce suppresses the address unless the status says the failure
was about the message, not the address (5.7.x, a policy rejection:
Karta.Suppressions.suppressible?/2), or the address already has an
entry from someone else (a complaint, an unsubscribe, a person). A
report that is not a bounce is a feedback report, read and recorded as
a complaint (Karta.Complaints.ingest/3); a success notice is ignored.
A report delivered twice is recorded once (report_key), and
everything is scoped by the server of the message the
return path names; a return path whose recipient or message is gone is
refused ({:error, :unknown_recipient}), as is one older than the
configured age ({:error, :expired}).
Summary
Functions
The bounces of a message, newest first.
Reads and records the report raw delivered for the recipient
recipient_id (the one the return path names). Options: :now (a
DateTime) and :max_age_days (default Karta.Outbound.ReturnPath.max_age_days/0).
Functions
@spec for_message(Ecto.UUID.t()) :: [Karta.Bounces.Bounce.t()]
The bounces of a message, newest first.
@spec ingest(term(), binary(), keyword()) :: {:ok, :recorded, Karta.Bounces.Bounce.t() | Karta.Complaints.Complaint.t()} | {:ok, :duplicate} | {:ok, :ignored} | {:error, atom()}
Reads and records the report raw delivered for the recipient
recipient_id (the one the return path names). Options: :now (a
DateTime) and :max_age_days (default Karta.Outbound.ReturnPath.max_age_days/0).
A delivery status notification is a bounce, recorded here; a feedback
report is a complaint, read and recorded by Karta.Complaints.ingest/3.
Returns {:ok, :recorded, bounce_or_complaint} (which one says what the
report was), {:ok, :duplicate} (the same report was recorded before),
{:ok, :ignored} (a success notice, or a not-spam complaint), or
{:error, reason}: :unknown_recipient, :expired, or what the
parsers say about a report that cannot be read.