Module: Sisimai::Reason::HasMoved

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

Overview

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

This is the error that a user’s mailbox has moved (and is not forwarded automatically). Sisimai will set “hasmoved” to the reason of email bounce if the value of Status: field in a bounce email is “5.1.6”.

Constant Summary collapse

Index =
[' has been replaced by '].freeze

Class Method Summary collapse

Class Method Details

.descriptionObject



14
# File 'lib/sisimai/reason/hasmoved.rb', line 14

def description; return "Email rejected due to user's mailbox has moved and is not forwarded automatically"; 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



19
20
21
22
23
# File 'lib/sisimai/reason/hasmoved.rb', line 19

def match(argv1)
  return false if argv1.nil? || argv1.empty?
  return true  if Index.any? { |a| argv1.include?(a) }
  return false
end

.textObject



13
# File 'lib/sisimai/reason/hasmoved.rb', line 13

def text; return 'hasmoved'; end

.true(argvs) ⇒ Boolean

Whether the address has moved or not

Parameters:

Returns:

  • (Boolean)

    true: The address has moved false: Has not moved

See Also:



30
31
32
33
34
# File 'lib/sisimai/reason/hasmoved.rb', line 30

def true(argvs)
  return true  if argvs['reason'] == 'hasmoved'
  return false if Sisimai::SMTP::Command::BeforeRCPT.include?(argvs['command'])
  return match(argvs['diagnosticcode'].downcase)
end