sisimai 4.25.16-java → 5.0.2-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/rake-test.yml +55 -0
  3. data/.travis.yml +3 -3
  4. data/ANALYTICAL-PRECISION +2 -2
  5. data/Benchmarks.mk +3 -3
  6. data/CONTRIBUTING +1 -1
  7. data/ChangeLog.md +451 -393
  8. data/Developers.mk +5 -6
  9. data/Gemfile +1 -1
  10. data/Makefile +15 -15
  11. data/README-JA.md +323 -149
  12. data/README.md +319 -149
  13. data/Rakefile +9 -3
  14. data/Repository.mk +2 -3
  15. data/lib/sisimai/address.rb +118 -74
  16. data/lib/sisimai/arf.rb +84 -82
  17. data/lib/sisimai/datetime.rb +5 -52
  18. data/lib/sisimai/{data → fact}/json.rb +7 -9
  19. data/lib/sisimai/fact/yaml.rb +31 -0
  20. data/lib/sisimai/fact.rb +506 -0
  21. data/lib/sisimai/lhost/activehunter.rb +12 -14
  22. data/lib/sisimai/lhost/amavis.rb +11 -14
  23. data/lib/sisimai/lhost/amazonses.rb +37 -42
  24. data/lib/sisimai/lhost/amazonworkmail.rb +15 -19
  25. data/lib/sisimai/lhost/aol.rb +12 -15
  26. data/lib/sisimai/lhost/apachejames.rb +19 -21
  27. data/lib/sisimai/lhost/barracuda.rb +10 -12
  28. data/lib/sisimai/lhost/bigfoot.rb +21 -22
  29. data/lib/sisimai/lhost/biglobe.rb +15 -16
  30. data/lib/sisimai/lhost/courier.rb +20 -20
  31. data/lib/sisimai/lhost/domino.rb +23 -20
  32. data/lib/sisimai/lhost/einsundeins.rb +23 -18
  33. data/lib/sisimai/lhost/exchange2003.rb +30 -29
  34. data/lib/sisimai/lhost/exchange2007.rb +70 -58
  35. data/lib/sisimai/lhost/exim.rb +179 -174
  36. data/lib/sisimai/lhost/ezweb.rb +31 -56
  37. data/lib/sisimai/lhost/facebook.rb +21 -34
  38. data/lib/sisimai/lhost/fml.rb +43 -48
  39. data/lib/sisimai/lhost/gmail.rb +29 -29
  40. data/lib/sisimai/lhost/gmx.rb +18 -17
  41. data/lib/sisimai/lhost/googlegroups.rb +11 -11
  42. data/lib/sisimai/lhost/gsuite.rb +21 -28
  43. data/lib/sisimai/lhost/imailserver.rb +25 -39
  44. data/lib/sisimai/lhost/interscanmss.rb +28 -31
  45. data/lib/sisimai/lhost/kddi.rb +22 -28
  46. data/lib/sisimai/lhost/mailfoundry.rb +11 -12
  47. data/lib/sisimai/lhost/mailmarshalsmtp.rb +25 -29
  48. data/lib/sisimai/lhost/mailru.rb +37 -40
  49. data/lib/sisimai/lhost/mcafee.rb +21 -31
  50. data/lib/sisimai/lhost/messagelabs.rb +17 -21
  51. data/lib/sisimai/lhost/messagingserver.rb +40 -37
  52. data/lib/sisimai/lhost/mfilter.rb +16 -17
  53. data/lib/sisimai/lhost/mxlogic.rb +24 -33
  54. data/lib/sisimai/lhost/notes.rb +17 -17
  55. data/lib/sisimai/lhost/office365.rb +64 -28
  56. data/lib/sisimai/lhost/opensmtpd.rb +12 -13
  57. data/lib/sisimai/lhost/outlook.rb +12 -16
  58. data/lib/sisimai/lhost/postfix.rb +179 -130
  59. data/lib/sisimai/lhost/powermta.rb +12 -14
  60. data/lib/sisimai/lhost/qmail.rb +44 -47
  61. data/lib/sisimai/lhost/receivingses.rb +15 -21
  62. data/lib/sisimai/lhost/sendgrid.rb +34 -34
  63. data/lib/sisimai/lhost/sendmail.rb +65 -53
  64. data/lib/sisimai/lhost/surfcontrol.rb +19 -19
  65. data/lib/sisimai/lhost/v5sendmail.rb +45 -39
  66. data/lib/sisimai/lhost/verizon.rb +35 -39
  67. data/lib/sisimai/lhost/x1.rb +18 -17
  68. data/lib/sisimai/lhost/x2.rb +17 -14
  69. data/lib/sisimai/lhost/x3.rb +19 -19
  70. data/lib/sisimai/lhost/x4.rb +72 -57
  71. data/lib/sisimai/lhost/x5.rb +17 -19
  72. data/lib/sisimai/lhost/x6.rb +41 -17
  73. data/lib/sisimai/lhost/yahoo.rb +17 -16
  74. data/lib/sisimai/lhost/yandex.rb +16 -21
  75. data/lib/sisimai/lhost/zoho.rb +16 -15
  76. data/lib/sisimai/lhost.rb +8 -10
  77. data/lib/sisimai/mail/maildir.rb +1 -3
  78. data/lib/sisimai/mail/mbox.rb +3 -4
  79. data/lib/sisimai/mail/memory.rb +0 -1
  80. data/lib/sisimai/mail/stdin.rb +1 -3
  81. data/lib/sisimai/mail.rb +3 -7
  82. data/lib/sisimai/mda.rb +28 -42
  83. data/lib/sisimai/message.rb +444 -326
  84. data/lib/sisimai/order.rb +5 -5
  85. data/lib/sisimai/reason/authfailure.rb +65 -0
  86. data/lib/sisimai/reason/badreputation.rb +53 -0
  87. data/lib/sisimai/reason/blocked.rb +96 -160
  88. data/lib/sisimai/reason/contenterror.rb +8 -9
  89. data/lib/sisimai/reason/delivered.rb +4 -6
  90. data/lib/sisimai/reason/exceedlimit.rb +10 -12
  91. data/lib/sisimai/reason/expired.rb +7 -8
  92. data/lib/sisimai/reason/feedback.rb +2 -3
  93. data/lib/sisimai/reason/filtered.rb +17 -19
  94. data/lib/sisimai/reason/hasmoved.rb +9 -10
  95. data/lib/sisimai/reason/hostunknown.rb +15 -15
  96. data/lib/sisimai/reason/mailboxfull.rb +11 -12
  97. data/lib/sisimai/reason/mailererror.rb +18 -20
  98. data/lib/sisimai/reason/mesgtoobig.rb +9 -11
  99. data/lib/sisimai/reason/networkerror.rb +5 -8
  100. data/lib/sisimai/reason/norelaying.rb +8 -11
  101. data/lib/sisimai/reason/notaccept.rb +13 -14
  102. data/lib/sisimai/reason/notcompliantrfc.rb +43 -0
  103. data/lib/sisimai/reason/onhold.rb +6 -9
  104. data/lib/sisimai/reason/policyviolation.rb +14 -12
  105. data/lib/sisimai/reason/rejected.rb +26 -24
  106. data/lib/sisimai/reason/requireptr.rb +69 -0
  107. data/lib/sisimai/reason/securityerror.rb +34 -36
  108. data/lib/sisimai/reason/spamdetected.rb +115 -147
  109. data/lib/sisimai/reason/speeding.rb +49 -0
  110. data/lib/sisimai/reason/suspend.rb +12 -11
  111. data/lib/sisimai/reason/syntaxerror.rb +11 -10
  112. data/lib/sisimai/reason/systemerror.rb +7 -9
  113. data/lib/sisimai/reason/systemfull.rb +7 -8
  114. data/lib/sisimai/reason/toomanyconn.rb +9 -11
  115. data/lib/sisimai/reason/undefined.rb +2 -3
  116. data/lib/sisimai/reason/userunknown.rb +129 -146
  117. data/lib/sisimai/reason/vacation.rb +3 -4
  118. data/lib/sisimai/reason/virusdetected.rb +10 -11
  119. data/lib/sisimai/reason.rb +59 -64
  120. data/lib/sisimai/rfc1894.rb +55 -28
  121. data/lib/sisimai/rfc2045.rb +373 -0
  122. data/lib/sisimai/rfc3464.rb +250 -308
  123. data/lib/sisimai/rfc3834.rb +42 -45
  124. data/lib/sisimai/rfc5322.rb +177 -146
  125. data/lib/sisimai/rfc5965.rb +31 -0
  126. data/lib/sisimai/rhost/cox.rb +5 -6
  127. data/lib/sisimai/rhost/franceptt.rb +6 -8
  128. data/lib/sisimai/rhost/godaddy.rb +12 -12
  129. data/lib/sisimai/rhost/google.rb +530 -0
  130. data/lib/sisimai/rhost/iua.rb +9 -10
  131. data/lib/sisimai/rhost/kddi.rb +6 -8
  132. data/lib/sisimai/rhost/{exchangeonline.rb → microsoft.rb} +115 -114
  133. data/lib/sisimai/rhost/mimecast.rb +51 -42
  134. data/lib/sisimai/rhost/nttdocomo.rb +12 -12
  135. data/lib/sisimai/rhost/spectrum.rb +10 -12
  136. data/lib/sisimai/rhost/{tencentqq.rb → tencent.rb} +7 -8
  137. data/lib/sisimai/rhost.rb +23 -31
  138. data/lib/sisimai/smtp/command.rb +59 -0
  139. data/lib/sisimai/smtp/error.rb +4 -7
  140. data/lib/sisimai/smtp/reply.rb +161 -74
  141. data/lib/sisimai/smtp/status.rb +507 -393
  142. data/lib/sisimai/smtp/transcript.rb +124 -0
  143. data/lib/sisimai/smtp.rb +0 -1
  144. data/lib/sisimai/string.rb +74 -5
  145. data/lib/sisimai/time.rb +1 -2
  146. data/lib/sisimai/version.rb +1 -1
  147. data/lib/sisimai.rb +46 -31
  148. data/set-of-emails/maildir/bsd/lhost-domino-02.eml +6 -3
  149. data/set-of-emails/maildir/bsd/lhost-googlegroups-15.eml +174 -0
  150. data/set-of-emails/maildir/bsd/lhost-gsuite-15.eml +229 -0
  151. data/set-of-emails/maildir/bsd/lhost-postfix-75.eml +51 -0
  152. data/set-of-emails/maildir/bsd/lhost-postfix-76.eml +101 -0
  153. data/set-of-emails/maildir/bsd/lhost-postfix-77.eml +74 -0
  154. data/set-of-emails/maildir/bsd/lhost-postfix-78.eml +91 -0
  155. data/set-of-emails/maildir/bsd/lhost-receivingses-08.eml +88 -0
  156. data/set-of-emails/maildir/bsd/lhost-sendmail-60.eml +85 -0
  157. data/set-of-emails/maildir/bsd/rfc3464-43.eml +88 -0
  158. data/set-of-emails/maildir/bsd/rhost-google-03.eml +101 -0
  159. data/set-of-emails/maildir/bsd/rhost-google-04.eml +102 -0
  160. data/set-of-emails/maildir/bsd/rhost-google-05.eml +82 -0
  161. data/set-of-emails/maildir/bsd/rhost-google-06.eml +102 -0
  162. data/set-of-emails/maildir/bsd/rhost-google-07.eml +69 -0
  163. data/set-of-emails/maildir/bsd/rhost-google-08.eml +99 -0
  164. data/sisimai-java.gemspec +1 -1
  165. data/sisimai.gemspec +1 -1
  166. metadata +48 -26
  167. data/.rspec +0 -2
  168. data/lib/sisimai/data/yaml.rb +0 -33
  169. data/lib/sisimai/data.rb +0 -411
  170. data/lib/sisimai/mime.rb +0 -456
  171. data/lib/sisimai/rhost/googleapps.rb +0 -261
  172. /data/set-of-emails/maildir/bsd/{rfc3464-41.eml → rfc3834-05.eml} +0 -0
  173. /data/set-of-emails/maildir/bsd/{rhost-googleapps-01.eml → rhost-google-01.eml} +0 -0
  174. /data/set-of-emails/maildir/bsd/{rhost-googleapps-02.eml → rhost-google-02.eml} +0 -0
  175. /data/set-of-emails/maildir/bsd/{rhost-exchangeonline-01.eml → rhost-microsoft-01.eml} +0 -0
  176. /data/set-of-emails/maildir/bsd/{rhost-exchangeonline-02.eml → rhost-microsoft-02.eml} +0 -0
  177. /data/set-of-emails/maildir/bsd/{rhost-exchangeonline-03.eml → rhost-microsoft-03.eml} +0 -0
  178. /data/set-of-emails/maildir/bsd/{rhost-tencentqq-01.eml → rhost-tencent-01.eml} +0 -0
  179. /data/set-of-emails/maildir/bsd/{rhost-tencentqq-02.eml → rhost-tencent-02.eml} +0 -0
  180. /data/set-of-emails/maildir/bsd/{rhost-tencentqq-03.eml → rhost-tencent-03.eml} +0 -0
data/lib/sisimai/order.rb CHANGED
@@ -1,13 +1,11 @@
1
1
  module Sisimai
2
- # Sisimai::Order - Parent class for making optimized order list for calling
3
- # MTA modules
2
+ # Sisimai::Order - Parent class for making optimized order list for calling MTA modules
4
3
  module Order
5
- # Imported from p5-Sisimail/lib/Sisimai/Order.pm
6
4
  class << self
7
5
  require 'sisimai/lhost'
8
6
 
9
- # There are another patterns in the value of "Subject:" header of a bounce
10
- # mail generated by the following MTA/ESP modules
7
+ # There are another patterns in the value of "Subject:" header of a bounce mail generated by the
8
+ # following MTA/ESP modules
11
9
  OrderE0 = [
12
10
  'Sisimai::Lhost::MailRu',
13
11
  'Sisimai::Lhost::Yandex',
@@ -121,9 +119,11 @@ module Sisimai
121
119
  'message-delivery' => ['Sisimai::Lhost::MailFoundry'],
122
120
  'message-frozen' => ['Sisimai::Lhost::Exim'],
123
121
  'message-you' => ['Sisimai::Lhost::Barracuda'],
122
+ 'não-entregue' => ['Sisimai::Lhost::Office365'],
124
123
  'non-recapitabile' => ['Sisimai::Lhost::Exchange2007'],
125
124
  'non-remis' => ['Sisimai::Lhost::Exchange2007'],
126
125
  'notice' => ['Sisimai::Lhost::Courier'],
126
+ 'onbestelbaar' => ['Sisimai::Lhost::Office365'],
127
127
  'permanent-delivery' => ['Sisimai::Lhost::X4'],
128
128
  'postmaster-notify' => ['Sisimai::Lhost::Sendmail'],
129
129
  'returned-mail' => [
@@ -0,0 +1,65 @@
1
+ module Sisimai
2
+ module Reason
3
+ # Sisimai::Reason::AuthFailure checks the bounce reason is "authfailure" or not. This class is
4
+ # called only Sisimai::Reason class.
5
+ #
6
+ # This is the error that an authenticaion failure related to SPF, DKIM, or DMARC was detected
7
+ # on a destination mail host.
8
+ #
9
+ # Action: failed
10
+ # Status: 5.7.1
11
+ # Remote-MTA: dns; smtp.example.com
12
+ # Diagnostic-Code: smtp; 550 5.7.1 Email rejected per DMARC policy for example.org
13
+ module AuthFailure
14
+ class << self
15
+ require 'sisimai/string'
16
+
17
+ Index = [
18
+ '//spf.pobox.com',
19
+ 'bad spf records for',
20
+ 'dmarc policy',
21
+ 'please inspect your spf settings',
22
+ 'sender policy framework (spf) fail',
23
+ 'sender policy framework violation',
24
+ 'spf (sender policy framework) domain authentication fail',
25
+ 'spf check: fail',
26
+ ].freeze
27
+ Pairs = [
28
+ [' is not allowed to send mail.', '_401'],
29
+ ['is not allowed to send from <', " per it's spf record"],
30
+ ].freeze
31
+
32
+ def text; return 'authfailure'; end
33
+ def description; return 'Email rejected due to SPF, DKIM, DMARC failure'; end
34
+
35
+ # Try to match that the given text and regular expressions
36
+ # @param [String] argv1 String to be matched with regular expressions
37
+ # @return [True,False] false: Did not match
38
+ # true: Matched
39
+ def match(argv1)
40
+ return nil unless argv1
41
+ return true if Index.any? { |a| argv1.include?(a) }
42
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
43
+ return false
44
+ end
45
+
46
+ # The bounce reason is "authfailure" or not
47
+ # @param [Sisimai::Fact] argvs Object to be detected the reason
48
+ # @return [True,False] true: is AuthFailure
49
+ # false: is not AuthFailure
50
+ # @see http://www.ietf.org/rfc/rfc2822.txt
51
+ def true(argvs)
52
+ return nil if argvs['deliverystatus'].empty?
53
+ return true if argvs['reason'] == 'authfailure'
54
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'authfailure'
55
+
56
+ # Check the value of Diagnosic-Code: header with patterns
57
+ return true if match(argvs['diagnosticcode'].downcase)
58
+ return false
59
+ end
60
+
61
+ end
62
+ end
63
+ end
64
+ end
65
+
@@ -0,0 +1,53 @@
1
+ module Sisimai
2
+ module Reason
3
+ # Sisimai::Reason::BadReputation checks the bounce reason is "badreputation" or not. This class
4
+ # is called only Sisimai::Reason class.
5
+ #
6
+ # This is the error that an email rejected due to a reputation score of the sender IP address.
7
+ #
8
+ # Action: failed
9
+ # Status: 5.7.1
10
+ # Remote-MTA: dns; gmail-smtp-in.l.google.com
11
+ # Diagnostic-Code: smtp; 550-5.7.1 [192.0.2.22] Our system has detected that this message is
12
+ # likely suspicious due to the very low reputation of the sending IP address.
13
+ # To best protect our users from spam, the message has been blocked. Please
14
+ # visit https://support.google.com/mail/answer/188131 for more information.
15
+ module BadReputation
16
+ class << self
17
+ Index = [
18
+ 'a poor email reputation score',
19
+ 'has been temporarily rate limited due to ip reputation',
20
+ 'ip/domain reputation problems',
21
+ 'likely suspicious due to the very low reputation',
22
+ "the sending mta's poor reputation",
23
+ ].freeze
24
+ def text; return 'badreputation'; end
25
+ def description; return 'Email rejected due to an IP address reputation'; end
26
+
27
+ # Try to match that the given text and regular expressions
28
+ # @param [String] argv1 String to be matched with regular expressions
29
+ # @return [True,False] false: Did not match
30
+ # true: Matched
31
+ def match(argv1)
32
+ return nil unless argv1
33
+ return true if Index.any? { |a| argv1.include?(a) }
34
+ return false
35
+ end
36
+
37
+ # The bounce reason is "badreputation" or not
38
+ # @param [Sisimai::Fact] argvs Object to be detected the reason
39
+ # @return [True,False] true: is BadReputation
40
+ # false: is not BadReputation
41
+ # @see http://www.ietf.org/rfc/rfc2822.txt
42
+ def true(argvs)
43
+ return nil if argvs['deliverystatus'].empty?
44
+ return true if argvs['reason'] == 'badreputation'
45
+ return true if match(argvs['diagnosticcode'].downcase)
46
+ return false
47
+ end
48
+
49
+ end
50
+ end
51
+ end
52
+ end
53
+
@@ -1,165 +1,99 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::Blocked checks the bounce reason is "blocked" or not.
4
- # This class is called only Sisimai::Reason class.
3
+ # Sisimai::Reason::Blocked checks the bounce reason is "blocked" or not. This class is called
4
+ # only Sisimai::Reason class.
5
5
  #
6
- # This is the error that SMTP connection was rejected due to a client IP address
7
- # or a hostname, or the parameter of "HELO/EHLO" command. This reason has added
8
- # in Sisimai 4.0.0 and does not exist in any version of bounceHammer.
6
+ # This is the error that SMTP connection was rejected due to a client IP address or a hostname,
7
+ # or the parameter of "HELO/EHLO" command. This reason has added in Sisimai 4.0.0.
9
8
  module Blocked
10
- # Imported from p5-Sisimail/lib/Sisimai/Reason/Blocked.pm
11
9
  class << self
10
+ require 'sisimai/string'
11
+
12
+ Index = [
13
+ ' said: 550 blocked',
14
+ '//www.spamcop.net/bl.',
15
+ 'bad sender ip address',
16
+ 'banned sending ip', # Office365
17
+ 'blacklisted by',
18
+ 'blocked using ',
19
+ 'blocked - see http',
20
+ 'dnsbl:attrbl',
21
+ 'client host rejected: abus detecte gu_eib_02', # SFR
22
+ 'client host rejected: abus detecte gu_eib_04', # SFR
23
+ 'client host rejected: may not be mail exchanger',
24
+ 'client host rejected: was not authenticated', # Microsoft
25
+ 'confirm this mail server',
26
+ 'connection dropped',
27
+ 'connection refused by',
28
+ 'connection reset by peer',
29
+ 'connection was dropped by remote host',
30
+ 'connections not accepted from ip addresses on spamhaus xbl',
31
+ 'currently sending spam see: ',
32
+ 'domain does not exist:',
33
+ 'dynamic/zombied/spam ips blocked',
34
+ 'error: no valid recipients from ',
35
+ 'esmtp not accepting connections', # icloud.com
36
+ 'extreme bad ip profile',
37
+ 'go away',
38
+ 'helo command rejected:',
39
+ 'host network not allowed',
40
+ 'hosts with dynamic ip',
41
+ 'invalid ip for sending mail of domain',
42
+ 'is not allowed to send mail from',
43
+ 'no access from mail server',
44
+ 'no matches to nameserver query',
45
+ 'not currently accepting mail from your ip', # Microsoft
46
+ 'part of their network is on our block list',
47
+ 'please use the smtp server of your isp',
48
+ 'refused - see http',
49
+ 'rejected - multi-blacklist', # junkemailfilter.com
50
+ 'rejected because the sending mta or the sender has not passed validation',
51
+ 'rejecting open proxy', # Sendmail(srvrsmtp.c)
52
+ 'sender ip address rejected',
53
+ 'server access forbidden by your ip ',
54
+ 'service not available, closing transmission channel',
55
+ 'smtp error from remote mail server after initial connection:', # Exim
56
+ "sorry, that domain isn't in my list of allowed rcpthosts",
57
+ 'sorry, your remotehost looks suspiciously like spammer',
58
+ 'temporarily deferred due to unexpected volume or user complaints',
59
+ 'to submit messages to this e-mail system has been rejected',
60
+ 'too many spams from your ip', # free.fr
61
+ 'too many unwanted messages have been sent from the following ip address above',
62
+ 'we do not accept mail from dynamic ips', # @mail.ru
63
+ 'you are not allowed to connect',
64
+ 'you are sending spam',
65
+ 'your network is temporary blacklisted',
66
+ 'your server requires confirmation',
67
+ ].freeze
68
+ Pairs = [
69
+ ['access from ip address ', ' blocked'],
70
+ ['client host ', ' blocked using'],
71
+ ['connections will not be accepted from ', " because the ip is in spamhaus's list"],
72
+ ['dnsbl:rbl ', '>_is_blocked'],
73
+ ['email blocked by ', '.barracudacentral.org'],
74
+ ['email blocked by ', 'spamhaus'],
75
+ ['ip ', ' is blocked by earthlink'], # Earthlink
76
+ ['is in an ', 'rbl on '],
77
+ ['mail server at ', ' is blocked'],
78
+ ['mail from ',' refused:'],
79
+ ['message from ', ' rejected based on blacklist'],
80
+ ['messages from ', ' temporarily deferred due to user complaints'], # Yahoo!
81
+ ['server ip ', ' listed as abusive'],
82
+ ['sorry! your ip address', ' is blocked by rbl'], # junkemailfilter.com
83
+ ['the domain ', ' is blacklisted'],
84
+ ['the email ', ' is blacklisted'],
85
+ ['the ip', ' is blacklisted'],
86
+ ['veuillez essayer plus tard. service refused, please try later. ', '103'],
87
+ ['veuillez essayer plus tard. service refused, please try later. ', '510'],
88
+ ["your sender's ip address is listed at ", '.abuseat.org'],
89
+ ].freeze
12
90
  Regex = %r{(?>
13
- [ ]said:[ ]550[ ]blocked
14
- |[(][^ ]+[@][^ ]+:blocked[)]
15
- |access[ ]denied[.][ ]ip[ ]name[ ]lookup[ ]failed
16
- |access[ ]from[ ]ip[ ]address[ ][^ ]+[ ]blocked
17
- |all[ ]mail[ ]servers[ ]must[ ]have[ ]a[ ]ptr[ ]record[ ]with[ ]a[ ]valid[ ]reverse[ ]dns[ ]entry
18
- |bad[ ](:?dns[ ]ptr[ ]resource[ ]record|sender[ ]ip[ ]address)
19
- |banned[ ]sending[ ]ip # Office365
20
- |blacklisted[ ]by
21
- |(?:blocked|refused)[ ]-[ ]see[ ]https?://
22
- |blocked[ ]using[ ]
23
- |can[']t[ ]determine[ ]purported[ ]responsible[ ]address
24
- |cannot[ ](?:
25
- find[ ]your[ ]hostname
26
- |resolve[ ]your[ ]address
27
- )
28
- |client[ ]host[ ](?:
29
- [^ ]+[ ]blocked[ ]using
30
- |rejected:[ ](?:
31
- abus[ ]detecte[ ]gu_eib_0[24] # SFR
32
- |cannot[ ]find[ ]your[ ]hostname # Yahoo!
33
- |may[ ]not[ ]be[ ]mail[ ]exchanger
34
- |was[ ]not[ ]authenticated # Microsoft
35
- )
36
- )
37
- |confirm[ ]this[ ]mail[ ]server
38
- |connection[ ](?:
39
- dropped
40
- |refused[ ]by
41
- |reset[ ]by[ ]peer
42
- |was[ ]dropped[ ]by[ ]remote[ ]host
43
- )
44
- |connections[ ](?:
45
- not[ ]accepted[ ]from[ ]ip[ ]addresses[ ]on[ ]spamhaus[ ]xbl
46
- |will[ ]not[ ]be[ ]accepted[ ]from[ ][^ ]+,[ ]because[ ]the[ ]ip[ ]is[ ]in[ ]spamhaus's[ ]list
47
- )
48
- |currently[ ]sending[ ]spam[ ]see:[ ]
49
- |domain[ ](?:
50
- [^ ]+[ ]mismatches[ ]client[ ]ip
51
- |does[ ]not[ ]exist:
52
- )
53
- |dns[ ]lookup[ ]failure:[ ][^ ]+[ ]try[ ]again[ ]later
54
- |dnsbl:(?:attrbl|rbl[ ]\d+[<][ ].+[ ][>]_is_blocked)
55
- |dynamic/zombied/spam[ ]ips[ ]blocked
56
- |email[ ]blocked[ ]by[ ](?:[^ ]+[.]barracudacentral[.]org|spamhaus)
57
- |error:[ ]no[ ]valid[ ]recipients[ ]from[ ]
58
- |esmtp[ ]not[ ]accepting[ ]connections # icloud.com
59
- |extreme[ ]bad[ ]ip[ ]profile
60
- |fix[ ]reverse[ ]dns[ ]for[ ][^ ]+
61
- |go[ ]away
62
- |helo[ ]command[ ]rejected:
63
- |host[ ]+[^ ]refused[ ]to[ ]talk[ ]to[ ]me:[ ]\d+[ ]blocked
64
- |host[ ]network[ ]not[ ]allowed
65
- |hosts[ ]with[ ]dynamic[ ]ip
66
- |http://(?:
67
- spf[.]pobox[.]com/why[.]html
68
- |www[.]spamcop[.]net/bl[.]
69
- )
70
- |invalid[ ]ip[ ]for[ ]sending[ ]mail[ ]of[ ]domain
71
- |ip[ ]\d{1,3}[.]\d{1,3}[.]\d{1,3}[.]\d{1,3}[ ]is[ ]blocked[ ]by[ ]EarthLink # Earthlink
72
- |ip[/]domain[ ]reputation[ ]problems
73
- |is[ ](?:
74
- in[ ]a[ ]black[ ]list(?:[ ]at[ ][^ ]+[.])?
75
- |in[ ]an[ ][^ ]+rbl[ ]on[ ][^ ]+
76
- |not[ ]allowed[ ]to[ ]send[ ](?:
77
- mail[ ]from
78
- |from[ ][<][^ ]+[>][ ]per[ ]it's[ ]spf[ ]record
79
- )
80
- )
81
- |mail[ ]server[ ]at[ ][^ ]+[ ]is[ ]blocked
82
- |mail[ ]from[ ]\d+[.]\d+[.]\d+[.]\d[ ]refused:
83
- |message[ ]from[ ][^ ]+[ ]rejected[ ]based[ ]on[ ]blacklist
84
- |message[ ]was[ ]rejected[ ]for[ ]possible[ ]spam/virus[ ]content
85
- |messages[ ]from[ ][^ ]+[ ]temporarily[ ]deferred[ ]due[ ]to[ ]user[ ]complaints # Yahoo!
86
- |no[ ](?:
87
- access[ ]from[ ]mail[ ]server
88
- |ptr[ ]record[ ]found[.]
89
- )
90
- |not[ ]currently[ ]accepting[ ]mail[ ]from[ ]your[ ]ip # Microsoft
91
- |part[ ]of[ ]their[ ]network[ ]is[ ]on[ ]our[ ]block[ ]list
92
- |please[ ](?:
93
- get[ ]a[ ]custom[ ]reverse[ ]dns[ ]name[ ]from[ ]your[ ]isp[ ]for[ ]your[ ]host
94
- |inspect[ ]your[ ]spf[ ]settings
95
- |use[ ]the[ ]smtp[ ]server[ ]of[ ]your[ ]isp
96
- )
97
- |ptr[ ]record[ ]setup
98
- |rejected[ ]because[ ]the[ ]sending[ ]mta[ ]or[ ]the[ ]sender[ ]has[ ]not[ ]passed[ ]validation
99
- |rejected[ ]due[ ]to[ ](?:
100
- a[ ]poor[ ]email[ ]reputation[ ]score
101
- |the[ ]sending[ ]mta's[ ]poor[ ]reputation
102
- )
103
- |rejecting[ ]open[ ]proxy # Sendmail(srvrsmtp.c)
104
- |reverse[ ]dns[ ](?:
105
- failed
106
- |required
107
- |lookup[ ]for[ ]host[ ][^ ]+[ ]failed[ ]permanently
108
- )
109
- |sender[ ]ip[ ](?:
110
- address[ ]rejected
111
- |reverse[ ]lookup[ ]rejected
112
- )
113
- |server[ ]access[ ](?:
114
- [^ ]+[ ]forbidden[ ]by[ ]invalid[ ]rdns[ ]record[ ]of[ ]your[ ]mail[ ]server
115
- |forbidden[ ]by[ ]your[ ]ip[ ]
116
- )
117
- |server[ ]ip[ ][^ ]+[ ]listed[ ]as[ ]abusive
118
- |service[ ]not[ ]available,[ ]closing[ ]transmission[ ]channel
119
- |service[ ]permits[ ]\d+[ ]unverifyable[ ]sending[ ]ips
120
- |smtp[ ]error[ ]from[ ]remote[ ]mail[ ]server[ ]after[ ]initial[ ]connection: # Exim
121
- |sorry,[ ](?:
122
- that[ ]domain[ ]isn'?t[ ]in[ ]my[ ]list[ ]of[ ]allowed[ ]rcpthosts
123
- |your[ ]remotehost[ ]looks[ ]suspiciously[ ]like[ ]spammer
124
- )
125
- |spf[ ](?:
126
- [(]sender[ ]policy[ ]framework[)][ ]domain[ ]authentication[ ]fail
127
- |record
128
- |check:[ ]fail
129
- )
130
- |spf:[ ][^ ]+[ ]is[ ]not[ ]allowed[ ]to[ ]send[ ]mail[.][ ][a-z0-9]_401
131
- |temporarily[ ]deferred[ ]due[ ]to[ ]unexpected[ ]volume[ ]or[ ]user[ ]complaints
132
- |the[ ](?:email|domain|ip)[ ][^ ]+[ ]is[ ]blacklisted
133
- |this[ ]system[ ]will[ ]not[ ]accept[ ]messages[ ]from[ ]servers[/]devices[ ]with[ ]no[ ]reverse[ ]dns
134
- |to[ ]submit[ ]messages[ ]to[ ]this[ ]e-mail[ ]system[ ]has[ ]been[ ]rejected
135
- |too[ ]many[ ](?:
136
- spams[ ]from[ ]your[ ]ip # free.fr
137
- |unwanted[ ]messages[ ]have[ ]been[ ]sent[ ]from[ ]the[ ]following[ ]ip[ ]address[ ]above
138
- )
139
- |unresolvable[ ]relay[ ]host[ ]name
140
- |veuillez[ ]essayer[ ]plus[ ]tard[.][ ]service[ ]refused,[ ]please[ ]try[ ]later[.][ ][0-9a-z_]+(?:103|510)
141
- |your[ ](?:
142
- network[ ]is[ ]temporary[ ]blacklisted
143
- |sender's[ ]ip[ ]address[ ]is[ ]listed[ ]at[ ][^ ]+[.]abuseat[.]org
144
- |server[ ]requires[ ]confirmation
145
- )
91
+ [(][^ ]+[@][^ ]+:blocked[)]
92
+ |host[ ][^ ]+[ ]refused[ ]to[ ]talk[ ]to[ ]me:[ ]\d+[ ]blocked
93
+ |is[ ]in[ ]a[ ]black[ ]list(?:[ ]at[ ][^ ]+[.])?
146
94
  |was[ ]blocked[ ]by[ ][^ ]+
147
- |we[ ]do[ ]not[ ]accept[ ]mail[ ]from[ ](?: # @mail.ru
148
- dynamic[ ]ips
149
- |hosts[ ]with[ ]dynamic[ ]ip[ ]or[ ]generic[ ]dns[ ]ptr-records
150
- )
151
- |you[ ]are[ ](?:
152
- not[ ]allowed[ ]to[ ]connect
153
- |sending[ ]spam
154
- )
155
- |your[ ](?:
156
- email[ ]address[ ]has[ ]been[ ]blacklisted
157
- |network[ ]is[ ]temporary[ ]blacklisted
158
- |sender's[ ]ip[ ]address[ ]is[ ]listed[ ]at[ ][^ ]+[.]abuseat[.]org
159
- |server[ ]requires[ ]confirmation
160
- )
161
95
  )
162
- }x
96
+ }x.freeze
163
97
 
164
98
  def text; return 'blocked'; end
165
99
  def description; return 'Email rejected due to client IP address or a hostname'; end
@@ -170,19 +104,21 @@ module Sisimai
170
104
  # true: Matched
171
105
  def match(argv1)
172
106
  return nil unless argv1
107
+ return true if Index.any? { |a| argv1.include?(a) }
108
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
173
109
  return true if argv1 =~ Regex
174
110
  return false
175
111
  end
176
112
 
177
113
  # Blocked due to client IP address or hostname
178
- # @param [Sisimai::Data] argvs Object to be detected the reason
179
- # @return [True,False] true: is blocked
180
- # false: is not blocked by the client
114
+ # @param [Hash] argvs Hash to be detected the value of reason
115
+ # @return [true,false] true: is blocked
116
+ # false: is not blocked by the client
181
117
  # @see http://www.ietf.org/rfc/rfc2822.txt
182
118
  def true(argvs)
183
- return true if argvs.reason == 'blocked'
184
- return true if Sisimai::SMTP::Status.name(argvs.deliverystatus).to_s == 'blocked'
185
- return true if match(argvs.diagnosticcode.downcase)
119
+ return true if argvs['reason'] == 'blocked'
120
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'blocked'
121
+ return true if match(argvs['diagnosticcode'].downcase)
186
122
  return false
187
123
  end
188
124
 
@@ -1,16 +1,15 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::ContentError checks the bounce reason is "contenterror"
4
- # or not This class is called only Sisimai::Reason class.
3
+ # Sisimai::Reason::ContentError checks the bounce reason is "contenterror" or not This class is
4
+ # called only Sisimai::Reason class.
5
5
  #
6
- # This is the error that a destination mail server has rejected email due to
7
- # header format of the email like the following. Sisimai will set "contenterror"
8
- # to the reason of email bounce if the value of Status: field in a bounce email
9
- # is "5.6.*".
6
+ # This is the error that a destination mail server has rejected email due to header format of the
7
+ # email like the following. Sisimai will set "contenterror" to the reason of email bounce if the
8
+ # value of Status: field in a bounce email is "5.6.*".
10
9
  module ContentError
11
- # Imported from p5-Sisimail/lib/Sisimai/Reason/ContentError.pm
12
10
  class << self
13
11
  Index = [
12
+ 'duplicate header',
14
13
  'header size exceeds maximum permitted',
15
14
  'improper use of 8-bit data in message header',
16
15
  'message header size, or recipient list, exceeds policy limit',
@@ -19,7 +18,7 @@ module Sisimai
19
18
  'this message contain invalid mime headers',
20
19
  'this message contain improperly-formatted binary content',
21
20
  'this message contain text that uses unnecessary base64 encoding',
22
- ]
21
+ ].freeze
23
22
 
24
23
  def text; return 'contenterror'; end
25
24
  def description; return 'Email rejected due to a header format of the email'; end
@@ -35,7 +34,7 @@ module Sisimai
35
34
  end
36
35
 
37
36
  # Rejected email due to header format of the email
38
- # @param [Sisimai::Data] argvs Object to be detected the reason
37
+ # @param [Sisimai::Fact] argvs Object to be detected the reason
39
38
  # @return [True,False] true: rejected due to content error
40
39
  # false: is not content error
41
40
  # @see http://www.ietf.org/rfc/rfc2822.txt
@@ -1,18 +1,16 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::Delivered checks the email you sent is delivered successfully
4
- # or not by matching diagnostic messages with message patterns. Sisimai will
5
- # set "delivered" to the value of "reason" when Status: field in the bounce
6
- # message begins with "2" like following:
3
+ # Sisimai::Reason::Delivered checks the email you sent is delivered successfully or not by matching
4
+ # diagnostic messages with message patterns. Sisimai will set "delivered" to the value of "reason"
5
+ # when Status: field in the bounce message begins with "2" like following:
7
6
  #
8
7
  # Final-Recipient: rfc822; kijitora@neko.nyaan.jp
9
- # Action: deliverable
8
+ # Action: delivered
10
9
  # Status: 2.1.5
11
10
  # Diagnostic-Code: SMTP; 250 2.1.5 OK
12
11
  #
13
12
  # This class is called only Sisimai.reason method. This is NOT AN ERROR reason.
14
13
  module Delivered
15
- # Imported from p5-Sisimail/lib/Sisimai/Reason/Delivered.pm
16
14
  class << self
17
15
  def text; return 'delivered'; end
18
16
  def description; return 'Email delivered successfully'; end
@@ -1,18 +1,16 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::ExceedLimit checks the bounce reason is "exceedlimit" or
4
- # not. This class is called only Sisimai::Reason class.
3
+ # Sisimai::Reason::ExceedLimit checks the bounce reason is "exceedlimit" or not. This class is
4
+ # called only Sisimai::Reason class.
5
5
  #
6
- # This is the error that a message was rejected due to an email exceeded the
7
- # limit. The value of D.S.N. is 5.2.3. This reason is almost the same as
8
- # "MesgTooBig", we think.
6
+ # This is the error that a message was rejected due to an email exceeded the limit. The value
7
+ # of D.S.N. is 5.2.3. This reason is almost the same as "MesgTooBig", we think.
9
8
  module ExceedLimit
10
- # Imported from p5-Sisimail/lib/Sisimai/Reason/ExceedLimit.pm
11
9
  class << self
12
10
  Index = [
13
11
  'message header size exceeds limit',
14
12
  'message too large',
15
- ]
13
+ ].freeze
16
14
 
17
15
  def text; return 'exceedlimit'; end
18
16
  def description; return 'Email rejected due to an email exceeded the limit'; end
@@ -28,21 +26,21 @@ module Sisimai
28
26
  end
29
27
 
30
28
  # Exceed limit or not
31
- # @param [Sisimai::Data] argvs Object to be detected the reason
29
+ # @param [Sisimai::Fact] argvs Object to be detected the reason
32
30
  # @return [True,False] true: Exceeds the limit
33
31
  # false: Did not exceed the limit
34
32
  # @see http://www.ietf.org/rfc/rfc2822.txt
35
33
  def true(argvs)
36
- return nil if argvs.deliverystatus.empty?
37
- return true if argvs.reason == 'exceedlimit'
34
+ return nil if argvs['deliverystatus'].empty?
35
+ return true if argvs['reason'] == 'exceedlimit'
38
36
 
39
37
  # Delivery status code points exceedlimit.
40
38
  # Status: 5.2.3
41
39
  # Diagnostic-Code: SMTP; 552 5.2.3 Message size exceeds fixed maximum message size
42
- return true if Sisimai::SMTP::Status.name(argvs.deliverystatus).to_s == 'exceedlimit'
40
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'exceedlimit'
43
41
 
44
42
  # Check the value of Diagnosic-Code: header with patterns
45
- return true if match(argvs.diagnosticcode.downcase)
43
+ return true if match(argvs['diagnosticcode'].downcase)
46
44
  return false
47
45
  end
48
46
 
@@ -1,13 +1,11 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::Expired checks the bounce reason is "expired" or not.
4
- # This class is called only Sisimai::Reason class.
3
+ # Sisimai::Reason::Expired checks the bounce reason is "expired" or not. This class is called only
4
+ # Sisimai::Reason class.
5
5
  #
6
- # This is the error that delivery time has expired due to connection failure
7
- # or network error and the message you sent has been in the queue for long
8
- # time.
6
+ # This is the error that delivery time has expired due to connection failure or network error and
7
+ # the message you sent has been in the queue for long time.
9
8
  module Expired
10
- # Imported from p5-Sisimail/lib/Sisimai/Reason/Expired.pm
11
9
  class << self
12
10
  Index = [
13
11
  'connection timed out',
@@ -20,6 +18,7 @@ module Sisimai
20
18
  'has been delayed',
21
19
  'it has not been collected after',
22
20
  'message expired after sitting in queue for',
21
+ 'message expired, cannot connect to remote server',
23
22
  'message expired, connection refulsed',
24
23
  'message timed out',
25
24
  'retry time not reached for any host after a long failure period',
@@ -28,7 +27,7 @@ module Sisimai
28
27
  'unable to deliver message after multiple retries',
29
28
  'was not reachable within the allowed queue period',
30
29
  'your message could not be delivered for more than',
31
- ]
30
+ ].freeze
32
31
 
33
32
  def text; return 'expired'; end
34
33
  def description; return 'Delivery time has expired due to a connection failure'; end
@@ -44,7 +43,7 @@ module Sisimai
44
43
  end
45
44
 
46
45
  # Delivery expired due to connection failure or network error
47
- # @param [Sisimai::Data] argvs Object to be detected the reason
46
+ # @param [Sisimai::Fact] argvs Object to be detected the reason
48
47
  # @return [True,False] true: is expired
49
48
  # false: is not expired
50
49
  # @see http://www.ietf.org/rfc/rfc2822.txt
@@ -1,9 +1,8 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::Feedback is for only returning text and description.
4
- # This class is called only from Sisimai.reason method and Sisimai::ARF class.
3
+ # Sisimai::Reason::Feedback is for only returning text and description. This class is called only
4
+ # from Sisimai.reason method and Sisimai::ARF class.
5
5
  module Feedback
6
- # Imported from p5-Sisimail/lib/Sisimai/Reason/Feedback.pm
7
6
  class << self
8
7
  def text; return 'feedback'; end
9
8
  def description; return 'Email forwarded to the sender as a complaint message from your mailbox provider'; end