MailAuth.DMARC (MailAuth v0.1.0)

Copy Markdown View Source

DMARC (RFC 9989): checks that a DKIM signature or the SPF check that passed belongs to the domain in the From: address, and reads the policy the domain publishes.

The organizational domain is found with RFC 9989's DNS tree walk, so no copy of the Public Suffix List is needed. A caller who wants the list's answers passes :organizational_domain.

Options

  • :spf: the MailAuth.SPF.Result of the message, if SPF ran
  • :organizational_domain: a function (domain, opts) -> {:ok, org} | {:error, reason} used instead of the tree walk. With it, the record is looked up at the From domain and then at its organizational domain, as RFC 7489 did
  • :resolver, :deadline, :timeout: see MailAuth.Resolver and MailAuth

Summary

Functions

Evaluates DMARC for raw, given its DKIM results and, in opts[:spf], its SPF result.

Looks up the DMARC record that applies to domain.

Functions

evaluate(raw, dkim_results, opts \\ [])

Evaluates DMARC for raw, given its DKIM results and, in opts[:spf], its SPF result.

lookup(domain, opts \\ [])

@spec lookup(String.t(), keyword()) ::
  {:ok, MailAuth.DMARC.Record.t(), String.t()}
  | {:error, :no_record | :dns_error | :deadline | :invalid_domain}

Looks up the DMARC record that applies to domain.

Returns the record (its domain field says where it was found) and the organizational domain.