Karta. Complaints
(Karta v1.0.0)
Complaints: the spam reports (feedback reports, RFC 5965) that come back
to the VERP return path (Karta.Outbound.ReturnPath) after Karta has
sent a message.
ingest/3 reads a report (Karta.Complaints.ARF), records it
(Karta.Complaints.Complaint), suppresses the address the return path
names (Karta.Suppressions) and emits the webhook event
message.complained in every format.
The return path decides, never the report. The recipient is the one
the HMAC-checked return path names, and the server is its message's: a
feedback report can only suppress an address of a message Karta sent
from that server. What the report says about the message — its
Original-Rcpt-To, the quoted message's Message-ID — is kept as
content and never used to decide anything.
A not-spam report says the message was legitimate: nothing is
suppressed and no event is emitted ({:ok, :ignored}). Everything else
— abuse, auth-failure, fraud, other, virus, and any type that
is not registered — suppresses the address with the reason complaint,
which outranks a bounce, an unsubscribe and an entry a person added.
The same report delivered twice is recorded once (report_key), and
nothing is ever sent to the reporter: a complaint about a complaint
would be more unwanted mail.
Summary
Functions
@spec for_message(Ecto.UUID.t()) :: [Karta.Complaints.Complaint.t()]
The complaints recorded for a message, newest first.
@spec ingest(Karta.Outbound.Recipient.t(), binary(), keyword()) :: {:ok, :recorded, Karta.Complaints.Complaint.t()} | {:ok, :duplicate} | {:ok, :ignored} | {:error, atom()}
Reads and records the feedback report raw delivered for recipient
(the one the return path names, with its message loaded). Options:
:now (a DateTime).
Returns {:ok, :recorded, complaint}, {:ok, :duplicate} (the same
report was recorded before), {:ok, :ignored} (a not-spam report), or
{:error, reason}: what Karta.Complaints.ARF.parse/1 says about a
message that is not a readable feedback report.