Module: Sisimai::Rhost
- Defined in:
- lib/sisimai/rhost.rb,
lib/sisimai/rhost/aol.rb,
lib/sisimai/rhost/cox.rb,
lib/sisimai/rhost/iua.rb,
lib/sisimai/rhost/kddi.rb,
lib/sisimai/rhost/zoho.rb,
lib/sisimai/rhost/apple.rb,
lib/sisimai/rhost/google.rb,
lib/sisimai/rhost/gsuite.rb,
lib/sisimai/rhost/godaddy.rb,
lib/sisimai/rhost/outlook.rb,
lib/sisimai/rhost/tencent.rb,
lib/sisimai/rhost/facebook.rb,
lib/sisimai/rhost/mimecast.rb,
lib/sisimai/rhost/spectrum.rb,
lib/sisimai/rhost/yahooinc.rb,
lib/sisimai/rhost/franceptt.rb,
lib/sisimai/rhost/microsoft.rb,
lib/sisimai/rhost/nttdocomo.rb,
lib/sisimai/rhost/cloudflare.rb,
lib/sisimai/rhost/messagelabs.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 listed in the results of Sisimai::Rhost ->list method. This class is called only Sisimai::Fact class.
Defined Under Namespace
Modules: Aol, Apple, Cloudflare, Cox, Facebook, FrancePTT, GSuite, GoDaddy, Google, IUA, KDDI, MessageLabs, Microsoft, Mimecast, NTTDOCOMO, Outlook, Spectrum, Tencent, YahooInc, Zoho
Constant Summary collapse
- RhostClass =
{ "Aol" => [".mail.aol.com", ".mx.aol.com"], "Apple" => [".mail.icloud.com", ".apple.com", ".me.com", "privaterelay.appleid.com"], "Cloudflare" => [".mx.cloudflare.net"], "Cox" => ["cox.net"], "Facebook" => [".facebook.com"], "FrancePTT" => [".laposte.net", ".orange.fr", ".wanadoo.fr"], "GoDaddy" => ["smtp.secureserver.net", "mailstore1.secureserver.net"], "Google" => ["aspmx.l.google.com", "gmail-smtp-in.l.google.com"], "GSuite" => ["googlemail.com"], "IUA" => [".email.ua"], "KDDI" => [".ezweb.ne.jp", "msmx.au.com"], "MessageLabs" => [".messagelabs.com"], "Microsoft" => [".prod.outlook.com", ".protection.outlook.com", ".onmicrosoft.com", ".exchangelabs.com"], "Mimecast" => [".mimecast.com"], "NTTDOCOMO" => ["mfsmax.docomo.ne.jp"], "Outlook" => [".hotmail.com"], "Spectrum" => ["charter.net"], "Tencent" => [".qq.com"], "YahooInc" => [".yahoodns.net"], "Zoho" => [".zoho.com", ".zoho.eu", ".zoho.jp", ".zoho.com.au", ".zoho.com.cn", ".zoho.in"], }.freeze
Class Method Summary collapse
-
.find(argvs) ⇒ String
Detect the bounce reason from certain remote hosts.
-
.name(argvs) ⇒ String
Returns the rhost class name.
Class Method Details
.find(argvs) ⇒ String
Detect the bounce reason from certain remote hosts
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/sisimai/rhost.rb', line 74 def find(argvs) return "" if argvs.nil? rhostclass = name(argvs); return "" if rhostclass.empty? modulepath = "sisimai/rhost/#{rhostclass.downcase}"; require modulepath modulename = "Sisimai::Rhost::#{rhostclass}" #rhostclass = "sisimai/rhost/" << modulename.downcase.split("::")[2]; require rhostclass reasontext = Module.const_get(modulename).find(argvs) return "" if reasontext.empty? return reasontext end |
.name(argvs) ⇒ String
Returns the rhost class name
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/sisimai/rhost.rb', line 33 def name(argvs) return "" if argvs.nil? rhostclass = "" clienthost = argvs["lhost"].downcase remotehost = argvs["rhost"].downcase domainpart = argvs["destination"].downcase catch :FINDRHOST do # Try to match the hostname patterns with the following order: # 1. destination: The domain part of the recipient address # 2. rhost: remote hostname # 3. lhost: local MTA hostname RhostClass.each_key do |e| # Try to match the domain part of the recipient address with each value of RhostClass next if RhostClass[e].none? { |a| a.end_with?(domainpart) } rhostclass = e throw :FINDRHOST end RhostClass.each_key do |e| # Try to match the remote host with each value of RhostClass next if RhostClass[e].none? { |a| remotehost.end_with?(a) } rhostclass = e throw :FINDRHOST end # Neither the remote host nor the destination did not matched with any value of RhostClass RhostClass.each_key do |e| # Try to match the client host with each value of RhostClass next if RhostClass[e].none? { |a| clienthost.end_with?(a) } rhostclass = e throw :FINDRHOST end end return rhostclass end |