Module: Sisimai::Reason::NotAccept

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

Overview

Sisimai::Reason::NotAccept checks the bounce reason is "NotAccept" or not. This class is called only Sisimai::Reason class.

This is the error that a destination mail server does ( or can ) not accept any email. In many case, the server is high load or under the maintenance. Sisimai will set "NotAccept" to the reason of email bounce if the value of Status: field in a bounce email is "5.3.2" or the value of SMTP reply code is 556.

Constant Summary collapse

Index =

Destination mail server does not accept any message

[
  "destination seem to reject all mails", # OpenSMTPD/smtp/mta.c
  "does not accept mail",                 # Sendmail, iCloud
  "mail receiving disabled",
  "mx or srv record indicated no smtp ",  # Exim/routers/dnslookup.c:328
  "name server: .: host not found",       # Sendmail
  "no host found for existing smtp ",     # Exim/transports/smtp.c:3502
  "no route for current request",
  "null mx",
].freeze
Pairs =
[
  ["no mx ", "found for "], # OpenSMTPD/smtp/mta.c
].freeze

Class Method Summary collapse

Class Method Details

.descriptionObject



29
# File 'lib/sisimai/reason/notaccept.rb', line 29

def description; return 'Delivery failed due to a destination mail server does not accept any email'; 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



34
35
36
37
38
39
# File 'lib/sisimai/reason/notaccept.rb', line 34

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



28
# File 'lib/sisimai/reason/notaccept.rb', line 28

def text; return Sisimai::Eb::Re00MX; end

.true(argvs) ⇒ True, False

Remote host does not accept any message

Parameters:

Returns:

  • (True, False)

    true: Not accept false: Accept

See Also:



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

def true(argvs)
  return true  if argvs['reason'] == Sisimai::Eb::Re00MX
  return true  if [521, 556].index(argvs['replycode'].to_i) # SMTP Reply Code is 554 or 556
  return false if Sisimai::SMTP::Command::BeforeRCPT.include?(argvs['command'])
  return match(argvs['diagnosticcode'].downcase)
end