Module: Sisimai::Reason::Suspend

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

Overview

Sisimai::Reason::Suspend checks the bounce reason is “suspend” or not. This class is called only Sisimai::Reason class. This is the error that a recipient account is being suspended due to unpaid or other reasons.

Constant Summary collapse

Index =
[
  " currently suspended",
  " temporary locked",
  "address no longer accepts mail",
  "archived recipient",
  "boite du destinataire archivee",
  "email account that you tried to reach is inactive",
  "inactive account",
  "inactivity new mail is not currently being accepted for this mailbox",
  "invalid/inactive user",
  "is a deactivated mailbox", # http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=20022&&no=1000742
  "is unavailable: user is terminated",
  "mailbox is frozen",
  "mailbox is inactive",
  "mailbox unavailable or access denied",
  "recipient rejected: temporarily inactive",
  "recipient suspend the service",
  "temporarily unavailable user",
  "user is no longer with ",
  "user or domain is disabled",
  "user suspended", # http://mail.163.com/help/help_spam_16.htm
  "vdelivermail: account is locked email bounced",
].freeze
Pairs =
[
  ["account ", "disabled"],
  ["account ", "limited"],
  ["has been ", "suspended"],
  ["mailaddress ", "disabled"],
  ["mailbox ", "disabled"],
  ["not ", "active"],
].freeze

Class Method Summary collapse

Class Method Details

.descriptionObject



41
# File 'lib/sisimai/reason/suspend.rb', line 41

def description; return 'Email rejected due to a recipient account is being suspended'; 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



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

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



40
# File 'lib/sisimai/reason/suspend.rb', line 40

def text; return 'suspend'; end

.true(argvs) ⇒ Boolean

The envelope recipient’s mailbox is suspended or not

Parameters:

Returns:

  • (Boolean)

    true: is mailbox suspended false: is not suspended

See Also:



58
59
60
61
# File 'lib/sisimai/reason/suspend.rb', line 58

def true(argvs)
  return true if argvs['reason'] == 'suspend' || argvs['replycode'].to_i == 525
  return match(argvs['diagnosticcode'].downcase)
end