Module: Sisimai::Reason::Blocked

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

Overview

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

This is the error that SMTP connection was rejected due to a client IP address or a hostname, or the parameter of “HELO/EHLO” command. This reason has added in Sisimai 4.0.0.

Constant Summary collapse

Index =
[
  "bad sender ip address",
  "banned sending ip", # Office365
  "blacklisted by",
  "dnsbl:attrbl",
  "client host rejected: abus detecte gu_eib_02", # SFR
  "client host rejected: abus detecte gu_eib_04", # SFR
  "client host rejected: may not be mail exchanger",
  "connection refused by",
  "currently sending spam see: ",
  "domain does not exist:",
  "domain isn't in my list of allowed rcpthosts",
  "error: no valid recipients from ",
  "esmtp not accepting connections", # icloud.com
  "extreme bad ip profile",
  "helo command rejected:",
  "host network not allowed",
  "invalid ip for sending mail of domain",
  "is in a black list",
  "is not allowed to send mail from",
  "no access from mail server",
  "part of their network is on our block list",
  "please use the smtp server of your isp",
  "rejected because the sending mta or the sender has not passed validation",
  "rejecting open proxy", # Sendmail(srvrsmtp.c)
  "sender ip address rejected",
  "server access forbidden by your ip ",
  "smtp error from remote mail server after initial connection:", # Exim
  "you are not allowed to connect",
  "your ip address is listed in the rbl",
  "your network is temporary blacklisted",
  "your remotehost looks suspiciously like spammer",
  "your server requires confirmation",
].freeze
Pairs =
[
  ["(", "@", ":blocked)"],
  ["access from ip address ", " blocked"],
  ["blocked by ", " dnsbl"],
  ["client ", " blocked using"],
  ["connection ", "dropped"],
  ["client host ", " blocked using"],
  ["connections will not be accepted from ", " because the ip is in spamhaus's list"],
  ["dynamic", " ip"],
  ["email blocked by ", ".barracudacentral.org"],
  ["email blocked by ", "spamhaus"],
  ["from ", " ip address"],
  ["host ", " said: ", "550 blocked"],
  ["host ", " refused to talk to me: ", " blocked"],
  ["ip ", " is blocked by earthlink"], # Earthlink
  ["is in an ", "rbl on "],
  ["mail server at ", " is blocked"],
  ["mail from "," refused"],
  ["message from ", " rejected based on blacklist"],
  ["messages from ", " temporarily deferred due to user complaints"], # Yahoo!
  ["server ip ", " listed as abusive"],
  ["sorry! your ip address", " is blocked by rbl"], # junkemailfilter.com
  ["the ", " is blacklisted"], # the email, the domain, the ip
  ["veuillez essayer plus tard. service refused, please try later. ", "103"],
  ["veuillez essayer plus tard. service refused, please try later. ", "510"],
  ["your access ip", " has been rejected"],
  ["your sender's ip address is listed at ", ".abuseat.org"],
].freeze

Class Method Summary collapse

Class Method Details

.descriptionObject



74
# File 'lib/sisimai/reason/blocked.rb', line 74

def description; return 'Email rejected due to client IP address or a hostname'; 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



79
80
81
82
83
84
# File 'lib/sisimai/reason/blocked.rb', line 79

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



73
# File 'lib/sisimai/reason/blocked.rb', line 73

def text; return 'blocked'; end

.true(argvs) ⇒ Boolean

Blocked due to client IP address or hostname

Parameters:

  • argvs (Hash)

    Hash to be detected the value of reason

Returns:

  • (Boolean)

    true: is blocked, false: is not blocked by the client

See Also:



90
91
92
93
94
# File 'lib/sisimai/reason/blocked.rb', line 90

def true(argvs)
  return true if argvs['reason'] == 'blocked'
  return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == 'blocked'
  return match(argvs['diagnosticcode'].downcase)
end