Karta.IPPools.SPF (Karta v1.0.0)

Whether a domain's SPF record (RFC 7208) authorises a sending address: the check of an IP pool's addresses against the domains that send from it (Karta.IPPools.check_spf/3). It is a configuration check, not the verification of received mail (Karta.Auth.SPF), whose evaluator it uses.

What depends on a message or on the connecting client cannot be known here: a macro (%{...}) or a ptr mechanism that evaluation reaches gives :unknown.

Results: :pass, :fail, :softfail, :neutral, :none (no SPF record), :permerror (a malformed record, more than one, too many lookups), :temperror (a DNS lookup failed) or :unknown.

Summary

Functions

The SPF result for mail from domain sent from ip. opts are options for Karta.DNS.lookup/3.

check/3, with the number of terms that looked up DNS on the way to the result (include, a, mx, exists, redirect; more than 10 is a :permerror). Evaluation stops at the first term that matches, so an address that matches no term counts every lookup the record needs.

Types

result()

@type result() ::
  :pass
  | :fail
  | :softfail
  | :neutral
  | :none
  | :permerror
  | :temperror
  | :unknown

Functions

check(ip, domain, opts \\ [])

@spec check(:inet.ip_address(), String.t(), keyword()) :: result()

The SPF result for mail from domain sent from ip. opts are options for Karta.DNS.lookup/3.

evaluate(ip, domain, opts)

@spec evaluate(:inet.ip_address(), String.t(), keyword()) ::
  {result(), non_neg_integer()}

check/3, with the number of terms that looked up DNS on the way to the result (include, a, mx, exists, redirect; more than 10 is a :permerror). Evaluation stops at the first term that matches, so an address that matches no term counts every lookup the record needs.