Module: MailAuth::Spf

Defined in:
lib/mailauth/spf.rb,
lib/mailauth/spf/macro.rb,
lib/mailauth/spf/budget.rb,
lib/mailauth/spf/record.rb

Overview

RFC 7208. Was this IP allowed to send for the envelope domain? Note how little a pass says: sender and domain are self-declared, and +all passes everyone.

Defined Under Namespace

Modules: Macro Classes: Budget, Context, Error, Evaluation, NoRecord, PermError, Record, TempError, Term

Constant Summary collapse

MAX_MX_EXCHANGES =

An mx may resolve ten exchanges and a ptr ten names — past that a stranger's zone is choosing how much work we do.

10
MAX_PTR_NAMES =
10
QUALIFIERS =
{
  "+" => Status::PASS, "-" => Status::FAIL, "~" => Status::SOFTFAIL, "?" => Status::NEUTRAL
}.freeze

Class Method Summary collapse

Class Method Details

.check(ip:, helo: nil, mail_from: nil, resolver: Resolver.new) ⇒ Object

Raises IPAddr::InvalidAddressError on a bad ip rather than guessing, which would risk authenticating the wrong host.



66
67
68
# File 'lib/mailauth/spf.rb', line 66

def self.check(ip:, helo: nil, mail_from: nil, resolver: Resolver.new)
  Evaluation.new(ip: ip, helo: helo, mail_from: mail_from, resolver: resolver).run
end