Writes and reads Authentication-Results: headers (RFC 8601).
Trust
Anyone can write an Authentication-Results: header. RFC 8601 says to read
one only when it comes from a server you were told to trust, and to remove
the ones claiming to be from your own servers when mail arrives. parse/2
marks each header trusted? only when its authserv_id is in the
:trusted list, and never trusts a header without one (as Outlook writes
them).
Checking DKIM and DMARC yourself, with MailAuth.authenticate/2, needs no
trust in any header.
Summary
Functions
Writes the Authentication-Results: header for a MailAuth.Result, under
authserv_id, the name of your server. Returns the whole header field,
folded, without a final line break.
Reads every Authentication-Results: header in a message, or one header
(with or without its name).
Types
@type t() :: %MailAuth.AuthenticationResults{ authserv_id: String.t() | nil, results: [MailAuth.AuthenticationResults.Method.t()], trusted?: boolean(), version: String.t() | nil, warnings: [atom()] }
Functions
@spec format(MailAuth.Result.t(), String.t()) :: String.t()
Writes the Authentication-Results: header for a MailAuth.Result, under
authserv_id, the name of your server. Returns the whole header field,
folded, without a final line break.
iex> result = %MailAuth.Result{dkim: [], spf: %MailAuth.SPF.Result{result: :none, reason: :no_client_ip}}
iex> MailAuth.AuthenticationResults.format(result, "mx.example.com")
"Authentication-Results: mx.example.com; none"
Reads every Authentication-Results: header in a message, or one header
(with or without its name).
Options:
:trusted: theauthserv_ids to trust, such as["mx.google.com"]. Compared without case
Unknown methods are kept. A header that can't be read in part gives what
could be read and the warning :malformed.