sisimai 4.25.16 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -3
  3. data/ANALYTICAL-PRECISION +2 -2
  4. data/Benchmarks.mk +3 -3
  5. data/CONTRIBUTING +1 -1
  6. data/ChangeLog.md +424 -393
  7. data/Developers.mk +5 -6
  8. data/Gemfile +1 -1
  9. data/Makefile +15 -15
  10. data/README-JA.md +323 -149
  11. data/README.md +319 -148
  12. data/Rakefile +9 -3
  13. data/Repository.mk +2 -3
  14. data/lib/sisimai/address.rb +118 -74
  15. data/lib/sisimai/arf.rb +84 -82
  16. data/lib/sisimai/datetime.rb +5 -52
  17. data/lib/sisimai/{data → fact}/json.rb +7 -9
  18. data/lib/sisimai/fact/yaml.rb +31 -0
  19. data/lib/sisimai/fact.rb +468 -0
  20. data/lib/sisimai/lhost/activehunter.rb +12 -14
  21. data/lib/sisimai/lhost/amavis.rb +11 -14
  22. data/lib/sisimai/lhost/amazonses.rb +37 -41
  23. data/lib/sisimai/lhost/amazonworkmail.rb +15 -18
  24. data/lib/sisimai/lhost/aol.rb +12 -14
  25. data/lib/sisimai/lhost/apachejames.rb +19 -21
  26. data/lib/sisimai/lhost/barracuda.rb +10 -12
  27. data/lib/sisimai/lhost/bigfoot.rb +21 -21
  28. data/lib/sisimai/lhost/biglobe.rb +15 -16
  29. data/lib/sisimai/lhost/courier.rb +20 -20
  30. data/lib/sisimai/lhost/domino.rb +23 -19
  31. data/lib/sisimai/lhost/einsundeins.rb +23 -18
  32. data/lib/sisimai/lhost/exchange2003.rb +30 -29
  33. data/lib/sisimai/lhost/exchange2007.rb +70 -58
  34. data/lib/sisimai/lhost/exim.rb +175 -161
  35. data/lib/sisimai/lhost/ezweb.rb +31 -56
  36. data/lib/sisimai/lhost/facebook.rb +21 -33
  37. data/lib/sisimai/lhost/fml.rb +43 -48
  38. data/lib/sisimai/lhost/gmail.rb +29 -29
  39. data/lib/sisimai/lhost/gmx.rb +18 -17
  40. data/lib/sisimai/lhost/googlegroups.rb +9 -10
  41. data/lib/sisimai/lhost/gsuite.rb +21 -27
  42. data/lib/sisimai/lhost/imailserver.rb +25 -39
  43. data/lib/sisimai/lhost/interscanmss.rb +28 -31
  44. data/lib/sisimai/lhost/kddi.rb +22 -28
  45. data/lib/sisimai/lhost/mailfoundry.rb +11 -12
  46. data/lib/sisimai/lhost/mailmarshalsmtp.rb +25 -29
  47. data/lib/sisimai/lhost/mailru.rb +33 -27
  48. data/lib/sisimai/lhost/mcafee.rb +21 -31
  49. data/lib/sisimai/lhost/messagelabs.rb +17 -20
  50. data/lib/sisimai/lhost/messagingserver.rb +40 -37
  51. data/lib/sisimai/lhost/mfilter.rb +15 -16
  52. data/lib/sisimai/lhost/mxlogic.rb +24 -23
  53. data/lib/sisimai/lhost/notes.rb +17 -17
  54. data/lib/sisimai/lhost/office365.rb +63 -27
  55. data/lib/sisimai/lhost/opensmtpd.rb +12 -13
  56. data/lib/sisimai/lhost/outlook.rb +12 -15
  57. data/lib/sisimai/lhost/postfix.rb +179 -129
  58. data/lib/sisimai/lhost/powermta.rb +12 -14
  59. data/lib/sisimai/lhost/qmail.rb +44 -47
  60. data/lib/sisimai/lhost/receivingses.rb +15 -20
  61. data/lib/sisimai/lhost/sendgrid.rb +34 -32
  62. data/lib/sisimai/lhost/sendmail.rb +66 -53
  63. data/lib/sisimai/lhost/surfcontrol.rb +19 -19
  64. data/lib/sisimai/lhost/v5sendmail.rb +45 -39
  65. data/lib/sisimai/lhost/verizon.rb +35 -39
  66. data/lib/sisimai/lhost/x1.rb +18 -17
  67. data/lib/sisimai/lhost/x2.rb +17 -14
  68. data/lib/sisimai/lhost/x3.rb +19 -19
  69. data/lib/sisimai/lhost/x4.rb +72 -57
  70. data/lib/sisimai/lhost/x5.rb +17 -19
  71. data/lib/sisimai/lhost/x6.rb +41 -17
  72. data/lib/sisimai/lhost/yahoo.rb +17 -16
  73. data/lib/sisimai/lhost/yandex.rb +16 -20
  74. data/lib/sisimai/lhost/zoho.rb +16 -15
  75. data/lib/sisimai/lhost.rb +8 -10
  76. data/lib/sisimai/mail/maildir.rb +1 -3
  77. data/lib/sisimai/mail/mbox.rb +3 -4
  78. data/lib/sisimai/mail/memory.rb +0 -1
  79. data/lib/sisimai/mail/stdin.rb +1 -3
  80. data/lib/sisimai/mail.rb +3 -7
  81. data/lib/sisimai/mda.rb +28 -42
  82. data/lib/sisimai/message.rb +435 -326
  83. data/lib/sisimai/order.rb +5 -5
  84. data/lib/sisimai/reason/authfailure.rb +64 -0
  85. data/lib/sisimai/reason/badreputation.rb +53 -0
  86. data/lib/sisimai/reason/blocked.rb +94 -160
  87. data/lib/sisimai/reason/contenterror.rb +8 -9
  88. data/lib/sisimai/reason/delivered.rb +4 -6
  89. data/lib/sisimai/reason/exceedlimit.rb +10 -12
  90. data/lib/sisimai/reason/expired.rb +6 -8
  91. data/lib/sisimai/reason/feedback.rb +2 -3
  92. data/lib/sisimai/reason/filtered.rb +17 -19
  93. data/lib/sisimai/reason/hasmoved.rb +9 -10
  94. data/lib/sisimai/reason/hostunknown.rb +15 -15
  95. data/lib/sisimai/reason/mailboxfull.rb +10 -12
  96. data/lib/sisimai/reason/mailererror.rb +18 -20
  97. data/lib/sisimai/reason/mesgtoobig.rb +9 -11
  98. data/lib/sisimai/reason/networkerror.rb +5 -8
  99. data/lib/sisimai/reason/norelaying.rb +8 -11
  100. data/lib/sisimai/reason/notaccept.rb +13 -14
  101. data/lib/sisimai/reason/notcompliantrfc.rb +43 -0
  102. data/lib/sisimai/reason/onhold.rb +6 -9
  103. data/lib/sisimai/reason/policyviolation.rb +14 -12
  104. data/lib/sisimai/reason/rejected.rb +26 -24
  105. data/lib/sisimai/reason/requireptr.rb +69 -0
  106. data/lib/sisimai/reason/securityerror.rb +33 -36
  107. data/lib/sisimai/reason/spamdetected.rb +114 -147
  108. data/lib/sisimai/reason/speeding.rb +49 -0
  109. data/lib/sisimai/reason/suspend.rb +11 -11
  110. data/lib/sisimai/reason/syntaxerror.rb +11 -10
  111. data/lib/sisimai/reason/systemerror.rb +7 -9
  112. data/lib/sisimai/reason/systemfull.rb +7 -8
  113. data/lib/sisimai/reason/toomanyconn.rb +9 -11
  114. data/lib/sisimai/reason/undefined.rb +2 -3
  115. data/lib/sisimai/reason/userunknown.rb +129 -146
  116. data/lib/sisimai/reason/vacation.rb +3 -4
  117. data/lib/sisimai/reason/virusdetected.rb +10 -11
  118. data/lib/sisimai/reason.rb +59 -64
  119. data/lib/sisimai/rfc1894.rb +55 -28
  120. data/lib/sisimai/rfc2045.rb +373 -0
  121. data/lib/sisimai/rfc3464.rb +250 -308
  122. data/lib/sisimai/rfc3834.rb +42 -45
  123. data/lib/sisimai/rfc5322.rb +75 -100
  124. data/lib/sisimai/rfc5965.rb +31 -0
  125. data/lib/sisimai/rhost/cox.rb +5 -6
  126. data/lib/sisimai/rhost/franceptt.rb +6 -8
  127. data/lib/sisimai/rhost/godaddy.rb +12 -12
  128. data/lib/sisimai/rhost/google.rb +530 -0
  129. data/lib/sisimai/rhost/iua.rb +9 -10
  130. data/lib/sisimai/rhost/kddi.rb +6 -8
  131. data/lib/sisimai/rhost/{exchangeonline.rb → microsoft.rb} +115 -114
  132. data/lib/sisimai/rhost/mimecast.rb +42 -40
  133. data/lib/sisimai/rhost/nttdocomo.rb +12 -12
  134. data/lib/sisimai/rhost/spectrum.rb +10 -12
  135. data/lib/sisimai/rhost/{tencentqq.rb → tencent.rb} +7 -8
  136. data/lib/sisimai/rhost.rb +23 -31
  137. data/lib/sisimai/smtp/command.rb +59 -0
  138. data/lib/sisimai/smtp/error.rb +4 -7
  139. data/lib/sisimai/smtp/reply.rb +161 -74
  140. data/lib/sisimai/smtp/status.rb +507 -393
  141. data/lib/sisimai/smtp/transcript.rb +124 -0
  142. data/lib/sisimai/smtp.rb +0 -1
  143. data/lib/sisimai/string.rb +74 -5
  144. data/lib/sisimai/time.rb +1 -2
  145. data/lib/sisimai/version.rb +1 -1
  146. data/lib/sisimai.rb +46 -31
  147. data/set-of-emails/maildir/bsd/lhost-domino-02.eml +6 -3
  148. data/set-of-emails/maildir/bsd/lhost-googlegroups-15.eml +174 -0
  149. data/set-of-emails/maildir/bsd/lhost-gsuite-15.eml +229 -0
  150. data/set-of-emails/maildir/bsd/lhost-postfix-75.eml +51 -0
  151. data/set-of-emails/maildir/bsd/lhost-postfix-76.eml +101 -0
  152. data/set-of-emails/maildir/bsd/lhost-postfix-77.eml +74 -0
  153. data/set-of-emails/maildir/bsd/lhost-postfix-78.eml +91 -0
  154. data/set-of-emails/maildir/bsd/lhost-receivingses-08.eml +88 -0
  155. data/set-of-emails/maildir/bsd/rfc3464-43.eml +88 -0
  156. data/set-of-emails/maildir/bsd/rhost-google-03.eml +101 -0
  157. data/set-of-emails/maildir/bsd/rhost-google-04.eml +102 -0
  158. data/set-of-emails/maildir/bsd/rhost-google-05.eml +82 -0
  159. data/set-of-emails/maildir/bsd/rhost-google-06.eml +102 -0
  160. data/set-of-emails/maildir/bsd/rhost-google-07.eml +69 -0
  161. data/set-of-emails/maildir/bsd/rhost-google-08.eml +99 -0
  162. data/sisimai-java.gemspec +1 -1
  163. data/sisimai.gemspec +1 -1
  164. metadata +41 -20
  165. data/.rspec +0 -2
  166. data/lib/sisimai/data/yaml.rb +0 -33
  167. data/lib/sisimai/data.rb +0 -411
  168. data/lib/sisimai/mime.rb +0 -456
  169. data/lib/sisimai/rhost/googleapps.rb +0 -261
  170. /data/set-of-emails/maildir/bsd/{rfc3464-41.eml → rfc3834-05.eml} +0 -0
  171. /data/set-of-emails/maildir/bsd/{rhost-googleapps-01.eml → rhost-google-01.eml} +0 -0
  172. /data/set-of-emails/maildir/bsd/{rhost-googleapps-02.eml → rhost-google-02.eml} +0 -0
  173. /data/set-of-emails/maildir/bsd/{rhost-exchangeonline-01.eml → rhost-microsoft-01.eml} +0 -0
  174. /data/set-of-emails/maildir/bsd/{rhost-exchangeonline-02.eml → rhost-microsoft-02.eml} +0 -0
  175. /data/set-of-emails/maildir/bsd/{rhost-exchangeonline-03.eml → rhost-microsoft-03.eml} +0 -0
  176. /data/set-of-emails/maildir/bsd/{rhost-tencentqq-01.eml → rhost-tencent-01.eml} +0 -0
  177. /data/set-of-emails/maildir/bsd/{rhost-tencentqq-02.eml → rhost-tencent-02.eml} +0 -0
  178. /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,64 @@
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
+ 'spf (sender policy framework) domain authentication fail',
24
+ 'spf check: fail',
25
+ ].freeze
26
+ Pairs = [
27
+ [' is not allowed to send mail.', '_401'],
28
+ ['is not allowed to send from <', " per it's spf record"],
29
+ ].freeze
30
+
31
+ def text; return 'authfailure'; end
32
+ def description; return 'Email rejected due to SPF, DKIM, DMARC failure'; end
33
+
34
+ # Try to match that the given text and regular expressions
35
+ # @param [String] argv1 String to be matched with regular expressions
36
+ # @return [True,False] false: Did not match
37
+ # true: Matched
38
+ def match(argv1)
39
+ return nil unless argv1
40
+ return true if Index.any? { |a| argv1.include?(a) }
41
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
42
+ return false
43
+ end
44
+
45
+ # The bounce reason is "authfailure" or not
46
+ # @param [Sisimai::Fact] argvs Object to be detected the reason
47
+ # @return [True,False] true: is AuthFailure
48
+ # false: is not AuthFailure
49
+ # @see http://www.ietf.org/rfc/rfc2822.txt
50
+ def true(argvs)
51
+ return nil if argvs['deliverystatus'].empty?
52
+ return true if argvs['reason'] == 'authfailure'
53
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'authfailure'
54
+
55
+ # Check the value of Diagnosic-Code: header with patterns
56
+ return true if match(argvs['diagnosticcode'].downcase)
57
+ return false
58
+ end
59
+
60
+ end
61
+ end
62
+ end
63
+ end
64
+
@@ -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,97 @@
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 because the sending mta or the sender has not passed validation',
50
+ 'rejecting open proxy', # Sendmail(srvrsmtp.c)
51
+ 'sender ip address rejected',
52
+ 'server access forbidden by your ip ',
53
+ 'service not available, closing transmission channel',
54
+ 'smtp error from remote mail server after initial connection:', # Exim
55
+ "sorry, that domain isn't in my list of allowed rcpthosts",
56
+ 'sorry, your remotehost looks suspiciously like spammer',
57
+ 'temporarily deferred due to unexpected volume or user complaints',
58
+ 'to submit messages to this e-mail system has been rejected',
59
+ 'too many spams from your ip', # free.fr
60
+ 'too many unwanted messages have been sent from the following ip address above',
61
+ 'we do not accept mail from dynamic ips', # @mail.ru
62
+ 'you are not allowed to connect',
63
+ 'you are sending spam',
64
+ 'your network is temporary blacklisted',
65
+ 'your server requires confirmation',
66
+ ].freeze
67
+ Pairs = [
68
+ ['access from ip address ', ' blocked'],
69
+ ['client host ', ' blocked using'],
70
+ ['connections will not be accepted from ', " because the ip is in spamhaus's list"],
71
+ ['dnsbl:rbl ', '>_is_blocked'],
72
+ ['email blocked by ', '.barracudacentral.org'],
73
+ ['email blocked by ', 'spamhaus'],
74
+ ['ip ', ' is blocked by earthlink'], # Earthlink
75
+ ['is in an ', 'rbl on '],
76
+ ['mail server at ', ' is blocked'],
77
+ ['mail from ',' refused:'],
78
+ ['message from ', ' rejected based on blacklist'],
79
+ ['messages from ', ' temporarily deferred due to user complaints'], # Yahoo!
80
+ ['server ip ', ' listed as abusive'],
81
+ ['the domain ', ' is blacklisted'],
82
+ ['the email ', ' is blacklisted'],
83
+ ['the ip', ' is blacklisted'],
84
+ ['veuillez essayer plus tard. service refused, please try later. ', '103'],
85
+ ['veuillez essayer plus tard. service refused, please try later. ', '510'],
86
+ ["your sender's ip address is listed at ", '.abuseat.org'],
87
+ ].freeze
12
88
  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
- )
89
+ [(][^ ]+[@][^ ]+:blocked[)]
90
+ |host[ ][^ ]+[ ]refused[ ]to[ ]talk[ ]to[ ]me:[ ]\d+[ ]blocked
91
+ |is[ ]in[ ]a[ ]black[ ]list(?:[ ]at[ ][^ ]+[.])?
146
92
  |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
93
  )
162
- }x
94
+ }x.freeze
163
95
 
164
96
  def text; return 'blocked'; end
165
97
  def description; return 'Email rejected due to client IP address or a hostname'; end
@@ -170,19 +102,21 @@ module Sisimai
170
102
  # true: Matched
171
103
  def match(argv1)
172
104
  return nil unless argv1
105
+ return true if Index.any? { |a| argv1.include?(a) }
106
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
173
107
  return true if argv1 =~ Regex
174
108
  return false
175
109
  end
176
110
 
177
111
  # 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
112
+ # @param [Hash] argvs Hash to be detected the value of reason
113
+ # @return [true,false] true: is blocked
114
+ # false: is not blocked by the client
181
115
  # @see http://www.ietf.org/rfc/rfc2822.txt
182
116
  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)
117
+ return true if argvs['reason'] == 'blocked'
118
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'blocked'
119
+ return true if match(argvs['diagnosticcode'].downcase)
186
120
  return false
187
121
  end
188
122
 
@@ -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',
@@ -28,7 +26,7 @@ module Sisimai
28
26
  'unable to deliver message after multiple retries',
29
27
  'was not reachable within the allowed queue period',
30
28
  'your message could not be delivered for more than',
31
- ]
29
+ ].freeze
32
30
 
33
31
  def text; return 'expired'; end
34
32
  def description; return 'Delivery time has expired due to a connection failure'; end
@@ -44,7 +42,7 @@ module Sisimai
44
42
  end
45
43
 
46
44
  # Delivery expired due to connection failure or network error
47
- # @param [Sisimai::Data] argvs Object to be detected the reason
45
+ # @param [Sisimai::Fact] argvs Object to be detected the reason
48
46
  # @return [True,False] true: is expired
49
47
  # false: is not expired
50
48
  # @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