sisimai 5.1.0-java → 5.2.0-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 (192) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake-test.yml +1 -1
  3. data/ChangeLog.md +102 -0
  4. data/Makefile +4 -2
  5. data/README-JA.md +23 -16
  6. data/README.md +22 -15
  7. data/lib/sisimai/arf.rb +121 -210
  8. data/lib/sisimai/fact.rb +208 -158
  9. data/lib/sisimai/lda.rb +98 -0
  10. data/lib/sisimai/lhost/activehunter.rb +1 -1
  11. data/lib/sisimai/lhost/amazonses.rb +185 -301
  12. data/lib/sisimai/lhost/apachejames.rb +48 -51
  13. data/lib/sisimai/lhost/biglobe.rb +1 -2
  14. data/lib/sisimai/lhost/courier.rb +10 -8
  15. data/lib/sisimai/lhost/domino.rb +25 -25
  16. data/lib/sisimai/lhost/dragonfly.rb +3 -4
  17. data/lib/sisimai/lhost/einsundeins.rb +3 -4
  18. data/lib/sisimai/lhost/exchange2003.rb +6 -8
  19. data/lib/sisimai/lhost/exchange2007.rb +111 -101
  20. data/lib/sisimai/lhost/exim.rb +232 -242
  21. data/lib/sisimai/lhost/ezweb.rb +43 -51
  22. data/lib/sisimai/lhost/fml.rb +2 -3
  23. data/lib/sisimai/lhost/gmail.rb +32 -28
  24. data/lib/sisimai/lhost/gmx.rb +4 -16
  25. data/lib/sisimai/lhost/googlegroups.rb +9 -8
  26. data/lib/sisimai/lhost/googleworkspace.rb +94 -0
  27. data/lib/sisimai/lhost/imailserver.rb +7 -16
  28. data/lib/sisimai/lhost/interscanmss.rb +1 -1
  29. data/lib/sisimai/lhost/kddi.rb +3 -4
  30. data/lib/sisimai/lhost/mailfoundry.rb +2 -5
  31. data/lib/sisimai/lhost/mailmarshalsmtp.rb +1 -2
  32. data/lib/sisimai/lhost/messagingserver.rb +14 -13
  33. data/lib/sisimai/lhost/mfilter.rb +4 -3
  34. data/lib/sisimai/lhost/notes.rb +2 -4
  35. data/lib/sisimai/lhost/opensmtpd.rb +2 -2
  36. data/lib/sisimai/lhost/postfix.rb +25 -27
  37. data/lib/sisimai/lhost/qmail.rb +130 -106
  38. data/lib/sisimai/lhost/sendmail.rb +19 -18
  39. data/lib/sisimai/lhost/v5sendmail.rb +88 -60
  40. data/lib/sisimai/lhost/verizon.rb +2 -2
  41. data/lib/sisimai/lhost/x1.rb +1 -1
  42. data/lib/sisimai/lhost/x2.rb +1 -2
  43. data/lib/sisimai/lhost/x3.rb +2 -2
  44. data/lib/sisimai/lhost/x6.rb +1 -1
  45. data/lib/sisimai/lhost/zoho.rb +2 -2
  46. data/lib/sisimai/lhost.rb +18 -21
  47. data/lib/sisimai/message.rb +93 -146
  48. data/lib/sisimai/order.rb +21 -77
  49. data/lib/sisimai/reason/authfailure.rb +1 -4
  50. data/lib/sisimai/reason/badreputation.rb +2 -2
  51. data/lib/sisimai/reason/blocked.rb +7 -10
  52. data/lib/sisimai/reason/contenterror.rb +7 -1
  53. data/lib/sisimai/reason/exceedlimit.rb +1 -4
  54. data/lib/sisimai/reason/failedstarttls.rb +42 -0
  55. data/lib/sisimai/reason/filtered.rb +5 -4
  56. data/lib/sisimai/reason/hasmoved.rb +1 -2
  57. data/lib/sisimai/reason/hostunknown.rb +3 -3
  58. data/lib/sisimai/reason/mailboxfull.rb +2 -4
  59. data/lib/sisimai/reason/mailererror.rb +1 -2
  60. data/lib/sisimai/reason/mesgtoobig.rb +2 -4
  61. data/lib/sisimai/reason/norelaying.rb +2 -3
  62. data/lib/sisimai/reason/notaccept.rb +2 -3
  63. data/lib/sisimai/reason/notcompliantrfc.rb +10 -4
  64. data/lib/sisimai/reason/rejected.rb +1 -1
  65. data/lib/sisimai/reason/requireptr.rb +2 -2
  66. data/lib/sisimai/reason/securityerror.rb +1 -3
  67. data/lib/sisimai/reason/spamdetected.rb +6 -8
  68. data/lib/sisimai/reason/speeding.rb +1 -2
  69. data/lib/sisimai/reason/suppressed.rb +36 -0
  70. data/lib/sisimai/reason/suspend.rb +1 -3
  71. data/lib/sisimai/reason/systemerror.rb +5 -0
  72. data/lib/sisimai/reason/toomanyconn.rb +1 -2
  73. data/lib/sisimai/reason/userunknown.rb +1 -1
  74. data/lib/sisimai/reason/virusdetected.rb +5 -6
  75. data/lib/sisimai/reason.rb +77 -73
  76. data/lib/sisimai/rfc1123.rb +152 -0
  77. data/lib/sisimai/rfc1894.rb +102 -62
  78. data/lib/sisimai/rfc2045.rb +2 -1
  79. data/lib/sisimai/rfc3464/thirdparty.rb +102 -0
  80. data/lib/sisimai/rfc3464.rb +222 -343
  81. data/lib/sisimai/rfc3834.rb +1 -1
  82. data/lib/sisimai/rfc5322.rb +7 -17
  83. data/lib/sisimai/rfc791.rb +69 -0
  84. data/lib/sisimai/rhost/aol.rb +36 -0
  85. data/lib/sisimai/rhost/apple.rb +5 -2
  86. data/lib/sisimai/rhost/cox.rb +3 -2
  87. data/lib/sisimai/rhost/facebook.rb +100 -0
  88. data/lib/sisimai/rhost/franceptt.rb +3 -2
  89. data/lib/sisimai/rhost/godaddy.rb +3 -2
  90. data/lib/sisimai/rhost/google.rb +19 -17
  91. data/lib/sisimai/rhost/gsuite.rb +42 -0
  92. data/lib/sisimai/rhost/iua.rb +3 -3
  93. data/lib/sisimai/rhost/kddi.rb +3 -2
  94. data/lib/sisimai/rhost/messagelabs.rb +37 -0
  95. data/lib/sisimai/rhost/microsoft.rb +56 -49
  96. data/lib/sisimai/rhost/mimecast.rb +29 -27
  97. data/lib/sisimai/rhost/nttdocomo.rb +4 -3
  98. data/lib/sisimai/rhost/outlook.rb +36 -0
  99. data/lib/sisimai/rhost/spectrum.rb +3 -2
  100. data/lib/sisimai/rhost/tencent.rb +3 -2
  101. data/lib/sisimai/rhost/yahooinc.rb +4 -3
  102. data/lib/sisimai/rhost.rb +69 -39
  103. data/lib/sisimai/smtp/command.rb +31 -21
  104. data/lib/sisimai/smtp/failure.rb +103 -0
  105. data/lib/sisimai/smtp/reply.rb +29 -25
  106. data/lib/sisimai/smtp/status.rb +36 -19
  107. data/lib/sisimai/smtp/transcript.rb +15 -15
  108. data/lib/sisimai/string.rb +0 -46
  109. data/lib/sisimai/version.rb +1 -1
  110. data/set-of-emails/maildir/bsd/lhost-postfix-30.eml +81 -81
  111. data/set-of-emails/maildir/bsd/{lhost-aol-03.eml → rhost-aol-03.eml} +1264 -1264
  112. data/set-of-emails/maildir/bsd/{lhost-aol-04.eml → rhost-aol-04.eml} +1260 -1260
  113. data/set-of-emails/maildir/bsd/{lhost-aol-05.eml → rhost-aol-05.eml} +105 -105
  114. data/set-of-emails/maildir/bsd/{lhost-aol-06.eml → rhost-aol-06.eml} +105 -105
  115. data/set-of-emails/maildir/bsd/rhost-gsuite-01.eml +189 -0
  116. data/set-of-emails/maildir/bsd/rhost-gsuite-02.eml +180 -0
  117. data/set-of-emails/maildir/bsd/rhost-gsuite-03.eml +251 -0
  118. data/set-of-emails/maildir/bsd/rhost-gsuite-04.eml +211 -0
  119. data/set-of-emails/maildir/bsd/rhost-gsuite-05.eml +226 -0
  120. data/set-of-emails/maildir/bsd/rhost-gsuite-06.eml +257 -0
  121. data/set-of-emails/maildir/bsd/rhost-gsuite-07.eml +289 -0
  122. data/set-of-emails/maildir/bsd/rhost-gsuite-08.eml +231 -0
  123. data/set-of-emails/maildir/bsd/rhost-gsuite-09.eml +231 -0
  124. data/set-of-emails/maildir/bsd/rhost-gsuite-10.eml +254 -0
  125. data/set-of-emails/maildir/bsd/rhost-gsuite-11.eml +228 -0
  126. data/set-of-emails/maildir/bsd/rhost-gsuite-12.eml +271 -0
  127. data/set-of-emails/maildir/bsd/rhost-gsuite-13.eml +261 -0
  128. data/set-of-emails/maildir/bsd/rhost-gsuite-14.eml +273 -0
  129. data/set-of-emails/maildir/bsd/rhost-gsuite-15.eml +229 -0
  130. data/set-of-emails/maildir/bsd/{lhost-messagelabs-01.eml → rhost-messagelabs-01.eml} +93 -93
  131. data/set-of-emails/maildir/bsd/rhost-outlook-01.eml +72 -0
  132. data/set-of-emails/maildir/bsd/rhost-outlook-02.eml +72 -0
  133. data/set-of-emails/maildir/bsd/rhost-outlook-03.eml +72 -0
  134. data/set-of-emails/maildir/bsd/rhost-outlook-04.eml +79 -0
  135. data/set-of-emails/maildir/bsd/rhost-outlook-06.eml +75 -0
  136. data/set-of-emails/maildir/bsd/rhost-outlook-07.eml +70 -0
  137. data/set-of-emails/maildir/bsd/rhost-outlook-08.eml +70 -0
  138. data/set-of-emails/maildir/bsd/rhost-outlook-09.eml +56 -0
  139. data/set-of-emails/maildir/tmp/arf-22.eml +49 -0
  140. data/set-of-emails/maildir/tmp/arf-23.eml +49 -0
  141. data/set-of-emails/maildir/tmp/arf-24.eml +50 -0
  142. data/set-of-emails/maildir/tmp/lhost-exim-07.eml +28 -0
  143. metadata +73 -56
  144. data/lib/sisimai/lhost/amavis.rb +0 -163
  145. data/lib/sisimai/lhost/amazonworkmail.rb +0 -127
  146. data/lib/sisimai/lhost/aol.rb +0 -125
  147. data/lib/sisimai/lhost/barracuda.rb +0 -92
  148. data/lib/sisimai/lhost/bigfoot.rb +0 -125
  149. data/lib/sisimai/lhost/facebook.rb +0 -188
  150. data/lib/sisimai/lhost/gsuite.rb +0 -194
  151. data/lib/sisimai/lhost/mailru.rb +0 -214
  152. data/lib/sisimai/lhost/mcafee.rb +0 -109
  153. data/lib/sisimai/lhost/messagelabs.rb +0 -120
  154. data/lib/sisimai/lhost/mxlogic.rb +0 -198
  155. data/lib/sisimai/lhost/office365.rb +0 -252
  156. data/lib/sisimai/lhost/outlook.rb +0 -129
  157. data/lib/sisimai/lhost/powermta.rb +0 -118
  158. data/lib/sisimai/lhost/receivingses.rb +0 -126
  159. data/lib/sisimai/lhost/sendgrid.rb +0 -150
  160. data/lib/sisimai/lhost/surfcontrol.rb +0 -105
  161. data/lib/sisimai/lhost/x4.rb +0 -269
  162. data/lib/sisimai/lhost/x5.rb +0 -112
  163. data/lib/sisimai/lhost/yahoo.rb +0 -102
  164. data/lib/sisimai/lhost/yandex.rb +0 -118
  165. data/lib/sisimai/mda.rb +0 -121
  166. data/lib/sisimai/smtp/error.rb +0 -119
  167. /data/set-of-emails/maildir/bsd/{lhost-googlegroups-15.eml → lhost-googleworkspace-01.eml} +0 -0
  168. /data/set-of-emails/maildir/bsd/{lhost-x4-08.eml → lhost-x2-06.eml} +0 -0
  169. /data/set-of-emails/maildir/bsd/{lhost-gsuite-01.eml → rfc3464-51.eml} +0 -0
  170. /data/set-of-emails/maildir/bsd/{lhost-gsuite-03.eml → rfc3464-52.eml} +0 -0
  171. /data/set-of-emails/maildir/bsd/{lhost-gsuite-04.eml → rfc3464-53.eml} +0 -0
  172. /data/set-of-emails/maildir/bsd/{lhost-gsuite-05.eml → rfc3464-54.eml} +0 -0
  173. /data/set-of-emails/maildir/bsd/{lhost-gsuite-06.eml → rfc3464-55.eml} +0 -0
  174. /data/set-of-emails/maildir/bsd/{lhost-gsuite-07.eml → rfc3464-56.eml} +0 -0
  175. /data/set-of-emails/maildir/bsd/{lhost-gsuite-08.eml → rfc3464-57.eml} +0 -0
  176. /data/set-of-emails/maildir/bsd/{lhost-gsuite-09.eml → rfc3464-58.eml} +0 -0
  177. /data/set-of-emails/maildir/bsd/{lhost-gsuite-10.eml → rfc3464-59.eml} +0 -0
  178. /data/set-of-emails/maildir/bsd/{lhost-gsuite-11.eml → rfc3464-60.eml} +0 -0
  179. /data/set-of-emails/maildir/bsd/{lhost-gsuite-12.eml → rfc3464-61.eml} +0 -0
  180. /data/set-of-emails/maildir/bsd/{lhost-gsuite-13.eml → rfc3464-62.eml} +0 -0
  181. /data/set-of-emails/maildir/bsd/{lhost-gsuite-14.eml → rfc3464-63.eml} +0 -0
  182. /data/set-of-emails/maildir/bsd/{lhost-gsuite-15.eml → rfc3464-64.eml} +0 -0
  183. /data/set-of-emails/maildir/bsd/{lhost-gsuite-02.eml → rfc3464-65.eml} +0 -0
  184. /data/set-of-emails/maildir/bsd/{lhost-aol-01.eml → rhost-aol-01.eml} +0 -0
  185. /data/set-of-emails/maildir/bsd/{lhost-aol-02.eml → rhost-aol-02.eml} +0 -0
  186. /data/set-of-emails/maildir/bsd/{lhost-facebook-03.eml → rhost-facebook-03.eml} +0 -0
  187. /data/set-of-emails/maildir/bsd/{lhost-facebook-04.eml → rhost-facebook-04.eml} +0 -0
  188. /data/set-of-emails/maildir/bsd/{lhost-messagelabs-02.eml → rhost-messagelabs-02.eml} +0 -0
  189. /data/set-of-emails/maildir/bsd/{lhost-messagelabs-03.eml → rhost-messagelabs-03.eml} +0 -0
  190. /data/set-of-emails/maildir/{bsd → tmp}/rfc3464-37.eml +0 -0
  191. /data/set-of-emails/maildir/{bsd → tmp}/rfc3464-38.eml +0 -0
  192. /data/set-of-emails/maildir/{bsd → tmp}/rfc3464-39.eml +0 -0
@@ -0,0 +1,42 @@
1
+ module Sisimai
2
+ module Reason
3
+ # Sisimai::Reason::FailedSTARTTLS checks the bounce reason is "failedstarttls" or not.
4
+ # This class is called only Sisimai::Reason class.
5
+ module FailedSTARTTLS
6
+ class << self
7
+ # Email delivery failed due to STARTTLS related problem
8
+ Index = [
9
+ 'starttls is required to send mail',
10
+ 'tls required but not supported', # SendGrid:the recipient mailserver does not support TLS or have a valid certificate
11
+ ].freeze
12
+
13
+ def text; return 'failedstarttls'; end
14
+ def description; return "Email delivery failed due to STARTTLS related problem"; end
15
+
16
+ # Try to match that the given text and regular expressions
17
+ # @param [String] argv1 String to be matched with regular expressions
18
+ # @return [True,False] false: Did not match
19
+ # true: Matched
20
+ def match(argv1)
21
+ return nil unless argv1
22
+ return true if Index.any? { |a| argv1.include?(a) }
23
+ return false
24
+ end
25
+
26
+ # Email delivery failed due to STARTTLS related problem
27
+ # @param [Sisimai::Fact] argvs Object to be detected the reason
28
+ # @return [True,False] true: FailedSTARTTLS
29
+ # false: Not FailedSTARTTLS
30
+ # @see http://www.ietf.org/rfc/rfc2822.txt
31
+ def true(argvs)
32
+ return true if argvs["reason"] == "failedstarttls"
33
+ return true if argvs["command"] == "STARTTLS"
34
+ return true if [523, 524, 538].index(argvs["replycode"].to_i)
35
+ return match(argvs["diagnosticcode"].downcase)
36
+ end
37
+
38
+ end
39
+ end
40
+ end
41
+ end
42
+
@@ -15,6 +15,7 @@ module Sisimai
15
15
  'due to extended inactivity new mail is not currently being accepted for this mailbox',
16
16
  'has restricted sms e-mail', # AT&T
17
17
  'is not accepting any mail',
18
+ "message filtered",
18
19
  'message rejected due to user rules',
19
20
  'not found recipient account',
20
21
  'refused due to recipient preferences', # Facebook
@@ -53,15 +54,15 @@ module Sisimai
53
54
  return false if tempreason == 'suspend'
54
55
 
55
56
  issuedcode = argvs['diagnosticcode'].downcase || ''
56
- thecommand = argvs['smtpcommand'] || ''
57
+ thecommand = argvs['command'] || ''
57
58
  if tempreason == 'filtered'
58
59
  # Delivery status code points "filtered".
59
60
  return true if Sisimai::Reason::UserUnknown.match(issuedcode)
60
61
  return true if match(issuedcode)
61
62
  else
62
- # The value of "reason" isn't "filtered" when the value of "smtpcommand" is an SMTP
63
- # command to be sent before the SMTP DATA command because all the MTAs read the headers
64
- # and the entire message body after the DATA command.
63
+ # The value of "reason" isn't "filtered" when the value of "command" is an SMTP command
64
+ # to be sent before the SMTP DATA command because all the MTAs read the headers and the
65
+ # entire message body after the DATA command.
65
66
  return false if %w[CONN EHLO HELO MAIL RCPT].include?(thecommand)
66
67
  return true if match(issuedcode)
67
68
  return true if Sisimai::Reason::UserUnknown.match(issuedcode)
@@ -30,8 +30,7 @@ module Sisimai
30
30
  # @see http://www.ietf.org/rfc/rfc2822.txt
31
31
  def true(argvs)
32
32
  return true if argvs['reason'] == 'hasmoved'
33
- return true if match(argvs['diagnosticcode'].downcase)
34
- return false
33
+ return match(argvs['diagnosticcode'].downcase)
35
34
  end
36
35
 
37
36
  end
@@ -54,12 +54,12 @@ module Sisimai
54
54
  statuscode = argvs['deliverystatus'] || ''
55
55
 
56
56
  if Sisimai::SMTP::Status.name(statuscode).to_s == 'hostunknown'
57
- # Status: 5.1.2
58
- # Diagnostic-Code: SMTP; 550 Host unknown
57
+ # To prevent classifying DNS errors as "HostUnknown"
59
58
  require 'sisimai/reason/networkerror'
60
59
  return true unless Sisimai::Reason::NetworkError.match(issuedcode)
61
60
  else
62
- # Check the value of Diagnosic-Code: header with patterns
61
+ # Status: 5.1.2
62
+ # Diagnostic-Code: SMTP; 550 Host unknown
63
63
  return true if match(issuedcode)
64
64
  end
65
65
 
@@ -37,6 +37,7 @@ module Sisimai
37
37
  'maildir delivery failed: domaindisk quota ',
38
38
  'mailfolder is full',
39
39
  'no space left on device',
40
+ 'not enough disk space',
40
41
  'not enough storage space in',
41
42
  'not sufficient disk space',
42
43
  'over the allowed quota',
@@ -84,10 +85,7 @@ module Sisimai
84
85
  # Status: 4.2.2
85
86
  # Diagnostic-Code: SMTP; 450 4.2.2 <***@example.jp>... Mailbox Full
86
87
  return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'mailboxfull'
87
-
88
- # Check the value of Diagnosic-Code: header with patterns
89
- return true if match(argvs['diagnosticcode'].downcase)
90
- return false
88
+ return match(argvs['diagnosticcode'].downcase)
91
89
  end
92
90
 
93
91
  end
@@ -11,6 +11,7 @@ module Sisimai
11
11
  module MailerError
12
12
  class << self
13
13
  Index = [
14
+ ' || exit ',
14
15
  'procmail: ',
15
16
  'bin/procmail',
16
17
  'bin/maidrop',
@@ -21,7 +22,6 @@ module Sisimai
21
22
  'pipe to |/',
22
23
  'x-unix; ',
23
24
  ].freeze
24
- Regex = %r/exit[ ]\d+/.freeze
25
25
 
26
26
  def text; return 'mailererror'; end
27
27
  def description; return 'Email returned due to a mailer program has not exited successfully'; end
@@ -33,7 +33,6 @@ module Sisimai
33
33
  def match(argv1)
34
34
  return nil unless argv1
35
35
  return true if Index.any? { |a| argv1.include?(a) }
36
- return true if argv1 =~ Regex
37
36
  return false
38
37
  end
39
38
 
@@ -8,6 +8,7 @@ module Sisimai
8
8
  class << self
9
9
  Index = [
10
10
  'exceeded maximum inbound message size',
11
+ 'exceeded the maximum incoming message size',
11
12
  'line limit exceeded',
12
13
  'max message size exceeded',
13
14
  'message file too big',
@@ -52,10 +53,7 @@ module Sisimai
52
53
 
53
54
  # 5.2.3 Message length exceeds administrative limit
54
55
  return false if( tempreason == 'exceedlimit' || statuscode == '5.2.3' )
55
-
56
- # Check the value of Diagnosic-Code: header with patterns
57
- return true if match(argvs['diagnosticcode'].downcase)
58
- return false
56
+ return match(argvs['diagnosticcode'].downcase)
59
57
  end
60
58
 
61
59
  end
@@ -53,9 +53,8 @@ module Sisimai
53
53
  def true(argvs)
54
54
  r = argvs['reason'] || ''
55
55
  return false if r.start_with?('securityerror', 'systemerror', 'undefined')
56
- return false if %w[CONN EHLO HELO].include?(argvs['smtpcommand'])
57
- return true if match(argvs['diagnosticcode'].downcase)
58
- return false
56
+ return false if %w[CONN EHLO HELO].include?(argvs['command'])
57
+ return match(argvs['diagnosticcode'].downcase)
59
58
  end
60
59
 
61
60
  end
@@ -44,9 +44,8 @@ module Sisimai
44
44
 
45
45
  # SMTP Reply Code is 554 or 556
46
46
  return true if [521, 554, 556].index(argvs['replycode'].to_i)
47
- return false if argvs['smtpcommand'] != 'MAIL'
48
- return true if match(argvs['diagnosticcode'].downcase)
49
- return false
47
+ return false if argvs['command'] != 'MAIL'
48
+ return match(argvs['diagnosticcode'].downcase)
50
49
  end
51
50
 
52
51
  end
@@ -7,10 +7,16 @@ module Sisimai
7
7
  # example, there are multiple "Subject" headers in the email.
8
8
  module NotCompliantRFC
9
9
  class << self
10
+ require 'sisimai/string'
10
11
  Index = [
11
- 'this message is not rfc 5322 compliant',
12
- 'https://support.google.com/mail/?p=rfcmessagenoncompliant',
12
+ 'duplicate header',
13
+ 'this message is not rfc 5322 compliant',
14
+ 'https://support.google.com/mail/?p=rfcmessagenoncompliant',
13
15
  ].freeze
16
+ Pairs = [
17
+ [' multiple ', ' header'],
18
+ ].freeze
19
+
14
20
 
15
21
  def text; return 'notcompliantrfc'; end
16
22
  def description; return 'Email rejected due to non-compliance with RFC'; end
@@ -22,6 +28,7 @@ module Sisimai
22
28
  def match(argv1)
23
29
  return nil unless argv1
24
30
  return true if Index.any? { |a| argv1.include?(a) }
31
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
25
32
  return false
26
33
  end
27
34
 
@@ -32,8 +39,7 @@ module Sisimai
32
39
  # @see http://www.ietf.org/rfc/rfc5322.txt
33
40
  def true(argvs)
34
41
  return true if argvs['reason'] == 'notcompliantrfc'
35
- return true if match(argvs['diagnosticcode'].downcase)
36
- return false
42
+ return match(argvs['diagnosticcode'].downcase)
37
43
  end
38
44
 
39
45
  end
@@ -102,7 +102,7 @@ module Sisimai
102
102
 
103
103
  # Check the value of Diagnosic-Code: header with patterns
104
104
  issuedcode = argvs['diagnosticcode'].downcase
105
- thecommand = argvs['smtpcommand'] || ''
105
+ thecommand = argvs['command'] || ''
106
106
  if thecommand == 'MAIL'
107
107
  # The session was rejected at 'MAIL FROM' command
108
108
  return true if match(issuedcode)
@@ -13,6 +13,7 @@ module Sisimai
13
13
  'all mail servers must have a ptr record with a valid reverse dns entry',
14
14
  'bad dns ptr resource record',
15
15
  'cannot find your hostname',
16
+ "cannot resolve your address.",
16
17
  'client host rejected: cannot find your hostname', # Yahoo!
17
18
  'fix reverse dns for ',
18
19
  'ips with missing ptr records',
@@ -58,8 +59,7 @@ module Sisimai
58
59
  def true(argvs)
59
60
  return true if argvs['reason'] == 'requireptr'
60
61
  return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'requireptr'
61
- return true if match(argvs['diagnosticcode'].downcase)
62
- return false
62
+ return match(argvs['diagnosticcode'].downcase)
63
63
  end
64
64
 
65
65
  end
@@ -29,8 +29,6 @@ module Sisimai
29
29
  'insecure mail relay',
30
30
  'recipient address rejected: access denied',
31
31
  "sorry, you don't authenticate or the domain isn't in my list of allowed rcpthosts",
32
- 'starttls is required to send mail',
33
- 'tls required but not supported', # SendGrid:the recipient mailserver does not support TLS or have a valid certificate
34
32
  'unauthenticated senders not allowed',
35
33
  'verification failure',
36
34
  'you are not authorized to send mail, authentication is required',
@@ -57,7 +55,7 @@ module Sisimai
57
55
  return false
58
56
  end
59
57
 
60
- # The bounce reason is security error or not
58
+ # The bounce reason is SecurityError or not
61
59
  # @param [Sisimai::Fact] argvs Object to be detected the reason
62
60
  # @return [True,False] true: is security error
63
61
  # false: is not security error
@@ -104,6 +104,7 @@ module Sisimai
104
104
  ].freeze
105
105
  Pairs = [
106
106
  ['greylisted', ' please try again in'],
107
+ ['mail score (', ' over '],
107
108
  ['mail rejete. mail rejected. ', '506'],
108
109
  ['our filters rate at and above ', ' percent probability of being spam'],
109
110
  ['rejected by ', ' (spam)'],
@@ -113,7 +114,6 @@ module Sisimai
113
114
  ['spam ', ' exceeded'],
114
115
  ['this message scored ', ' spam points'],
115
116
  ].freeze
116
- Regex = %r/(?:\d[.]\d[.]\d|\d{3})[ ]spam\z/.freeze
117
117
 
118
118
  def text; return 'spamdetected'; end
119
119
  def description; return 'Email rejected by spam filter running on the remote host'; end
@@ -126,7 +126,6 @@ module Sisimai
126
126
  return nil unless argv1
127
127
  return true if Index.any? { |a| argv1.include?(a) }
128
128
  return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
129
- return true if argv1 =~ Regex
130
129
  return false
131
130
  end
132
131
 
@@ -140,12 +139,11 @@ module Sisimai
140
139
  return true if argvs['reason'] == 'spamdetected'
141
140
  return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'spamdetected'
142
141
 
143
- # The value of "reason" isn't "spamdetected" when the value of "smtpcommand" is an SMTP
144
- # command to be sent before the SMTP DATA command because all the MTAs read the headers
145
- # and the entire message body after the DATA command.
146
- return false if %w[CONN EHLO HELO MAIL RCPT].include?(argvs['smtpcommand'])
147
- return true if match(argvs['diagnosticcode'].downcase)
148
- return false
142
+ # The value of "reason" isn't "spamdetected" when the value of "command" is an SMTP command
143
+ # to be sent before the SMTP DATA command because all the MTAs read the headers and the
144
+ # entire message body after the DATA command.
145
+ return false if %w[CONN EHLO HELO MAIL RCPT].include?(argvs['command'])
146
+ return match(argvs['diagnosticcode'].downcase)
149
147
  end
150
148
 
151
149
  end
@@ -38,8 +38,7 @@ module Sisimai
38
38
  # Remote-MTA: dns; smtp.example.jp
39
39
  # Diagnostic-Code: smtp; 451 4.7.1 <mx.example.org[192.0.2.2]>: Client host rejected:
40
40
  # Please try again slower
41
- return true if match(argvs['diagnosticcode'].downcase)
42
- return false
41
+ return match(argvs['diagnosticcode'].downcase)
43
42
  end
44
43
 
45
44
  end
@@ -0,0 +1,36 @@
1
+ module Sisimai
2
+ module Reason
3
+ # Sisimai::Reason::Suppressed checks the bounce reason is "suppressed" or not. This class is called
4
+ # only Sisimai::Reason class.
5
+ #
6
+ # This is the error that the recipient adddress is listed in the suppression list of the relay
7
+ # server, and was not delivered.
8
+ module Suppressed
9
+ class << self
10
+ def text; return 'suppressed'; end
11
+ def description; return "Email was not delivered due to being listed in the suppression list of MTA"; end
12
+
13
+ # Try to match that the given text and regular expressions
14
+ # @param [String] argv1 String to be matched with regular expressions
15
+ # @return [True,False] false: Did not match
16
+ # true: Matched
17
+ def match(argv1)
18
+ return nil unless argv1
19
+ return false
20
+ end
21
+
22
+ # Whether the address is listed in the suppression list
23
+ # @param [Sisimai::Fact] argvs Object to be detected the reason
24
+ # @return [True,False] true: The address is listed in the suppression list
25
+ # false: is not listed in the suppression list
26
+ # @see http://www.ietf.org/rfc/rfc2822.txt
27
+ def true(argvs)
28
+ return true if argvs['reason'] == 'suppressed'
29
+ return match(argvs['diagnosticcode'].downcase)
30
+ end
31
+
32
+ end
33
+ end
34
+ end
35
+ end
36
+
@@ -50,11 +50,9 @@ module Sisimai
50
50
  # false: is not suspended
51
51
  # @see http://www.ietf.org/rfc/rfc2822.txt
52
52
  def true(argvs)
53
- return nil if argvs['deliverystatus'].empty?
54
53
  return true if argvs['reason'] == 'suspend'
55
54
  return true if argvs['replycode'].to_i == 525
56
- return true if match(argvs['diagnosticcode'].downcase)
57
- return false
55
+ return match(argvs['diagnosticcode'].downcase)
58
56
  end
59
57
 
60
58
  end
@@ -9,6 +9,7 @@ module Sisimai
9
9
  # message has been in the queue too long.
10
10
  module SystemError
11
11
  class << self
12
+ require 'sisimai/string'
12
13
  Index = [
13
14
  'aliasing/forwarding loop broken',
14
15
  "can't create user output file",
@@ -33,6 +34,9 @@ module Sisimai
33
34
  'timeout waiting for input',
34
35
  'transaction failed ',
35
36
  ].freeze
37
+ Pairs = [
38
+ ['unable to connect ', 'daemon'],
39
+ ].freeze
36
40
 
37
41
  def text; return 'systemerror'; end
38
42
  def description; return 'Email returned due to system error on the remote host'; end
@@ -44,6 +48,7 @@ module Sisimai
44
48
  def match(argv1)
45
49
  return nil unless argv1
46
50
  return true if Index.any? { |a| argv1.include?(a) }
51
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
47
52
  return false
48
53
  end
49
54
 
@@ -48,8 +48,7 @@ module Sisimai
48
48
  def true(argvs)
49
49
  return true if argvs['reason'] == 'toomanyconn'
50
50
  return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'toomanyconn'
51
- return true if match(argvs['diagnosticcode'].downcase)
52
- return false
51
+ return match(argvs['diagnosticcode'].downcase)
53
52
  end
54
53
 
55
54
  end
@@ -191,7 +191,7 @@ module Sisimai
191
191
  end
192
192
  return true unless matchother # Did not match with other message patterns
193
193
 
194
- elsif argvs['smtpcommand'] == 'RCPT'
194
+ elsif argvs['command'] == 'RCPT'
195
195
  # When the SMTP command is not "RCPT", the session rejected by other
196
196
  # reason, maybe.
197
197
  return true if match(issuedcode)
@@ -44,13 +44,12 @@ module Sisimai
44
44
  # @since 4.22.0
45
45
  # @see http://www.ietf.org/rfc/rfc2822.txt
46
46
  def true(argvs)
47
- # The value of "reason" isn't "visusdetected" when the value of "smtpcommand" is an SMTP
48
- # command to be sent before the SMTP DATA command because all the MTAs read the headers
49
- # and the entire message body after the DATA command.
47
+ # The value of "reason" isn't "visusdetected" when the value of "command" is an SMTP command
48
+ # to be sent before the SMTP DATA command because all the MTAs read the headers and the
49
+ # entire message body after the DATA command.
50
50
  return true if argvs['reason'] == 'virusdetected'
51
- return false if %w[CONN EHLO HELO MAIL RCPT].include?(argvs['smtpcommand'])
52
- return true if match(argvs['diagnosticcode'].downcase)
53
- return false
51
+ return false if %w[CONN EHLO HELO MAIL RCPT].include?(argvs['command'])
52
+ return match(argvs['diagnosticcode'].downcase)
54
53
  end
55
54
 
56
55
  end