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



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

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



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

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



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

def text; return 'notaccept'; end

.true(argvs) ⇒ True, False

Remote host does not accept any message

Parameters:

Returns:

  • (True, False)

    true: Not accept false: Accept

See Also:



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

def true(argvs)
  return true  if argvs['reason'] == 'notaccept'
  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