Module: Sisimai::Reason::NoRelaying

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

Overview

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

... while talking to mailin-01.mx.example.com.:
>>> RCPT To:<kijitora@example.org>
<<< 554 5.7.1 <kijitora@example.org>: Relay access denied
554 5.0.0 Service unavailable

Constant Summary collapse

Index =
[
  "as a relay",
  "domain isn't in my list of allowed rcpthost",
  "email address is not verified.",
  "insecure mail relay",
  "no relaying",
  "not a gateway",
  "not local host",
  "open relay",
  "relay not permitted",
  "relay prohibition",
  "relaying denied", # Sendmail
  "relaying mail to ",
  "send to a non-local e-mail address", # MailEnable
  "specified domain is not allowed",
  "unable to relay ",
  "we don't handle mail for",
].freeze
Pairs =
[
  ["relay ", "denied"],
  ["n", "t ", "to relay"],
].freeze

Class Method Summary collapse

Class Method Details

.descriptionObject



36
# File 'lib/sisimai/reason/norelaying.rb', line 36

def description; return 'Email rejected with error message "Relaying Denied"'; 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



41
42
43
44
45
46
# File 'lib/sisimai/reason/norelaying.rb', line 41

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



35
# File 'lib/sisimai/reason/norelaying.rb', line 35

def text; return 'norelaying'; end

.true(argvs) ⇒ Boolean

Whether the message is rejected by ‘Relaying denied’

Parameters:

Returns:

  • (Boolean)

    true: Rejected for “relaying denied” false: is not

See Also:



53
54
55
56
57
58
# File 'lib/sisimai/reason/norelaying.rb', line 53

def true(argvs)
  r = argvs['reason'] || ''
  return false if Sisimai::SMTP::Command::BeforeRCPT.include?(argvs['command'])
  return false if r.start_with?('securityerror', 'systemerror', 'undefined')
  return match(argvs['diagnosticcode'].downcase)
end