A DMARC policy record (RFC 7489 §6.3), as published in TXT at
_dmarc.<domain>.
{:ok, record} = Sovite.DMARC.Record.parse("v=DMARC1; p=reject; rua=mailto:d@example.com")
record.p #=> :reject
record.sp #=> :rejectParsing is lenient, as RFC 7489 §6.3 asks: unknown tags are ignored,
and a known tag with an invalid value gets its default. After a
successful parse no field is nil except psd:
spdefaults top, andnp(DMARCbis) tosp.ruaandrufkeep onlymailto:URIs, each with the size limit from a!sizesuffix (RFC 7489 §6.4), ornil.testingis the DMARCbist=yflag, andpsdthe DMARCbispsd=tag::yes,:no, ornilforuor absent.
Summary
Types
An identifier alignment mode.
A requested policy for failing mail.
A report destination and the largest report it accepts, in bytes.
Functions
Returns whether a TXT record claims to be a DMARC record: its first
tag is v=DMARC1. Records that do not are discarded during policy
discovery.
Parses a DMARC record.
Types
@type mode() :: :relaxed | :strict
An identifier alignment mode.
@type policy() :: :none | :quarantine | :reject
A requested policy for failing mail.
@type uri() :: %{uri: String.t(), max_size: non_neg_integer() | nil}
A report destination and the largest report it accepts, in bytes.
Functions
Returns whether a TXT record claims to be a DMARC record: its first
tag is v=DMARC1. Records that do not are discarded during policy
discovery.
Parses a DMARC record.
Fails if v=DMARC1 is not the first tag, or if p is missing or
invalid and there is no valid rua (RFC 7489 §6.6.3; with a valid
rua, p is taken as none).