Module: Sisimai::Reason::AuthFailure

Defined in:
lib/sisimai/reason/authfailure.rb

Overview

Sisimai::Reason::AuthFailure checks the bounce reason is “authfailure” or not. This class is called only Sisimai::Reason class.

This is the error that an authenticaion failure related to SPF, DKIM, or DMARC was detected on a destination mail host.

Action: failed Status: 5.7.1 Remote-MTA: dns; smtp.example.com Diagnostic-Code: smtp; 550 5.7.1 Email rejected per DMARC policy for example.org

Constant Summary collapse

Index =
[
  "//spf.pobox.com",
  "5322.From address doesn't meet the authentication requirements",
  "bad spf records for",
  "dmarc policy",
  "doesn't meet the required authentication level",
  "please inspect your spf settings",
  "sender policy framework",
  "spf check: fail",
].freeze
Pairs =
[
  ["spf: ", " is not allowed to send "],
  ["is not allowed to send ", " spf "],
].freeze

Class Method Summary collapse

Class Method Details

.descriptionObject



31
# File 'lib/sisimai/reason/authfailure.rb', line 31

def description; return 'Email rejected due to SPF, DKIM, DMARC failure'; end

.match(argv1) ⇒ Boolean

Try to match that the given text and regular expressions

Parameters:

  • argv1 (String)

    String to be matched with regular expressions

Returns:

  • (Boolean)

    false: Did not match, true: Matched



36
37
38
39
40
41
# File 'lib/sisimai/reason/authfailure.rb', line 36

def match(argv1)
  return false if argv1.nil? || argv1.empty?
  return true  if Index.any? { |a| argv1.include?(a) }
  return true  if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
  return false
end

.textObject



30
# File 'lib/sisimai/reason/authfailure.rb', line 30

def text; return 'authfailure'; end

.true(argvs) ⇒ Boolean

The bounce reason is “authfailure” or not

Parameters:

Returns:

  • (Boolean)

    true: is AuthFailure, false: is not AuthFailure

See Also:



47
48
49
50
51
52
# File 'lib/sisimai/reason/authfailure.rb', line 47

def true(argvs)
  return false if argvs['deliverystatus'].empty?
  return true  if argvs['reason'] == 'authfailure'
  return true  if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == 'authfailure'
  return match(argvs['diagnosticcode'].downcase)
end