module Sisimai::Reason::HostUnknown

This is the error that a domain part ( Right hand side of @ sign ) of a recipient's email address does not exist. In many case, the domain part is misspelled, or the domain name has been expired. Sisimai will set “hostunknown” to the reason of email bounce if the value of Status: field in a bounce mail is “5.1.2”.

Constants

Index
Regex

Public Class Methods

description() click to toggle source
# File lib/sisimai/reason/hostunknown.rb, line 31
def description; return "Delivery failed due to a domain part of a recipient's email address does not exist"; end
match(argv1) click to toggle source

Try to match that the given text and regular expressions @param [String] argv1 String to be matched with regular expressions @return [True,False] false: Did not match

true:  Matched

@since v4.0.0

# File lib/sisimai/reason/hostunknown.rb, line 38
def match(argv1)
  return nil unless argv1
  return true if Index.any? { |a| argv1.include?(a) }
  return true if argv1 =~ Regex
  return false
end
text() click to toggle source
# File lib/sisimai/reason/hostunknown.rb, line 30
def text; return 'hostunknown'; end
true(argvs) click to toggle source

Whether the host is unknown or not @param [Sisimai::Data] argvs Object to be detected the reason @return [True,False] true: is unknown host

false: is not unknown host.

@see www.ietf.org/rfc/rfc2822.txt

# File lib/sisimai/reason/hostunknown.rb, line 50
def true(argvs)
  return true if argvs.reason == 'hostunknown'

  diagnostic = argvs.diagnosticcode.downcase || ''
  statuscode = argvs.deliverystatus || ''

  if Sisimai::SMTP::Status.name(statuscode).to_s == 'hostunknown'
    # Status: 5.1.2
    # Diagnostic-Code: SMTP; 550 Host unknown
    require 'sisimai/reason/networkerror'
    return true unless Sisimai::Reason::NetworkError.match(diagnostic)
  else
    # Check the value of Diagnosic-Code: header with patterns
    return true if match(diagnostic)
  end

  return false
end