Module: Sisimai::Rhost::Cloudflare

Defined in:
lib/sisimai/rhost/cloudflare.rb

Overview

Sisimai::Rhost detects the bounce reason from the content of Sisimai::Fact object as an argument of find() method when the value of “rhost” of the object is “*.mx.cloudflare.net”. This class is called only from Sisimai::Fact class.

Constant Summary collapse

MessagesOf =
{
  # - 554 <YOUR_IP_ADDRESS> found on one or more RBLs (abusixip). Refer to
  #   https://developers.cloudflare.com/email-routing/postmaster/#spam-and-abusive-traffic/
  "blocked"     => ["found on one or more DNSBLs"],
  "systemerror" => ["Upstream error"],
}.freeze

Class Method Summary collapse

Class Method Details

.find(argvs) ⇒ String

Detect bounce reason from Cloudflare Email Routing

Parameters:

Returns:

  • (String)

    The bounce reason for Cloudflare

See Also:

Since:

  • v5.2.1



20
21
22
23
24
25
26
27
# File 'lib/sisimai/rhost/cloudflare.rb', line 20

def find(argvs)
  return "" if argvs["diagnosticcode"].empty?
  MessagesOf.each_key do |e|
    # Try to match the error message with message patterns defined in $MessagesOf
    return e if MessagesOf[e].any? { |a| argvs["diagnosticcode"].include?(a) }
  end
  return ""
end