Class: MailAuth::AuthenticationResults

Inherits:
Object
  • Object
show all
Defined in:
lib/mailauth/authentication_results.rb

Overview

RFC 8601. States the verdicts in an Authentication-Results header for a downstream MTA to read.

Constant Summary collapse

LINE_WIDTH =

RFC 5322 §2.1.1

78
INDENT =
" ".freeze
FOLD =
"\r\n#{INDENT}".freeze
UNKNOWN_AUTHSERV_ID =

RFC 8601 §2.2 requires an authserv-id. Without one we say so out loud rather than emitting a header that appears to be signed by nobody.

"unknown".freeze
NO_RESULTS =
"none".freeze
TOKEN =

A pvalue may be an RFC 2045 token or a bare addr-spec, so "@" and "." ride along unquoted; everything else has to become a quoted-string.

/\A[!#-'*+\-.0-9@-Z^-~]+\z/

Instance Method Summary collapse

Constructor Details

#initialize(spf:, dkim:, dmarc:, arc: nil, mta: nil, header_from: nil) ⇒ AuthenticationResults

header_from is optional: a DmarcResult carries a verdict, not an identity; pass the From: domain to have it reported as header.from.



20
21
22
# File 'lib/mailauth/authentication_results.rb', line 20

def initialize(spf:, dkim:, dmarc:, arc: nil, mta: nil, header_from: nil)
  @spf, @dkim, @dmarc, @arc, @mta, @header_from = spf, dkim, dmarc, arc, mta, header_from
end

Instance Method Details

#to_sObject

The value alone — everything after "Authentication-Results:" — so the caller writes the field name itself.



26
27
28
# File 'lib/mailauth/authentication_results.rb', line 26

def to_s
  fold segments
end