Karta. Outbound. Body
(Karta v1.0.0)
A stored outgoing message read once, in chunks, for delivery: the facts a delivery needs about it, and the body hashes DKIM signs, without holding the message.
What one pass gives:
size— the octets of the message, for theSIZEparameter ofMAIL FROMand the local check against the receiving server's limit;headerandskip— the header block as stored and its length, which is what a signature replaces;fields— the header fields, parsed (Karta.Mail.Headers);eight_bit— whether any octet of the message is not ASCII, which asks forBODY=8BITMIME;header_ascii— whether the header block is ASCII, which decides SMTPUTF8 together with the envelope;bare_line_ending— whether a CR or LF stands alone: such a message is bounced, never sent (Karta.SMTP.Client.Stuff);tls_required_no— RFC 8689 §3: exactly oneTLS-Requiredfield, with the valueNo;body_hash— for each canonicalisation asked for, the SHA-256 of the canonical body (Karta.Auth.DKIM.BodyHash), which a signature needs in front of the message it signs.
A message whose header block cannot be parsed (over a megabyte, a line
over 8192 octets, or a line that is neither a field nor a continuation
with no empty line before it) has header and fields nil: it is sent
as it is and unsigned, as Karta.Outbound.Signing did before.
Summary
Functions
The same facts for a message held in memory, with the same options as scan/2.
Reads the message's stored body once. Options: :blob_store (as
Karta.Storage), and :hash — the body canonicalisations whose hashes
the caller needs ([:relaxed], [:simple, :relaxed], or none).
Types
@type t() :: %Karta.Outbound.Body{ bare_line_ending: boolean(), body_hash: %{required(atom()) => binary()} | nil, eight_bit: boolean(), fields: [Karta.Mail.Header.t()] | nil, header: binary() | nil, header_ascii: boolean(), size: non_neg_integer(), skip: non_neg_integer(), tls_required_no: boolean() }
Functions
The same facts for a message held in memory, with the same options as scan/2.
@spec scan(Karta.Messages.Message.t(), keyword()) :: {:ok, t()} | {:error, term()}
Reads the message's stored body once. Options: :blob_store (as
Karta.Storage), and :hash — the body canonicalisations whose hashes
the caller needs ([:relaxed], [:simple, :relaxed], or none).