sisimai 5.2.1-java → 5.4.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 (113) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake-test.yml +1 -1
  3. data/ChangeLog.md +24 -0
  4. data/Makefile +3 -2
  5. data/README-JA.md +4 -4
  6. data/README.md +8 -8
  7. data/lib/sisimai/address.rb +45 -56
  8. data/lib/sisimai/arf.rb +11 -16
  9. data/lib/sisimai/datetime.rb +16 -50
  10. data/lib/sisimai/fact/json.rb +5 -5
  11. data/lib/sisimai/fact/yaml.rb +3 -3
  12. data/lib/sisimai/fact.rb +21 -12
  13. data/lib/sisimai/lda.rb +3 -3
  14. data/lib/sisimai/lhost/activehunter.rb +4 -6
  15. data/lib/sisimai/lhost/amazonses.rb +5 -6
  16. data/lib/sisimai/lhost/apachejames.rb +7 -9
  17. data/lib/sisimai/lhost/biglobe.rb +3 -5
  18. data/lib/sisimai/lhost/courier.rb +4 -6
  19. data/lib/sisimai/lhost/domino.rb +4 -5
  20. data/lib/sisimai/lhost/dragonfly.rb +3 -5
  21. data/lib/sisimai/lhost/einsundeins.rb +6 -8
  22. data/lib/sisimai/lhost/exchange2003.rb +10 -12
  23. data/lib/sisimai/lhost/exchange2007.rb +4 -5
  24. data/lib/sisimai/lhost/exim.rb +6 -8
  25. data/lib/sisimai/lhost/ezweb.rb +10 -12
  26. data/lib/sisimai/lhost/fml.rb +2 -3
  27. data/lib/sisimai/lhost/gmail.rb +4 -6
  28. data/lib/sisimai/lhost/gmx.rb +6 -8
  29. data/lib/sisimai/lhost/googlegroups.rb +1 -2
  30. data/lib/sisimai/lhost/googleworkspace.rb +3 -4
  31. data/lib/sisimai/lhost/imailserver.rb +6 -7
  32. data/lib/sisimai/lhost/interscanmss.rb +1 -2
  33. data/lib/sisimai/lhost/kddi.rb +5 -8
  34. data/lib/sisimai/lhost/mailfoundry.rb +4 -7
  35. data/lib/sisimai/lhost/mailmarshalsmtp.rb +4 -6
  36. data/lib/sisimai/lhost/messagingserver.rb +5 -7
  37. data/lib/sisimai/lhost/mfilter.rb +4 -6
  38. data/lib/sisimai/lhost/notes.rb +7 -9
  39. data/lib/sisimai/lhost/opensmtpd.rb +2 -4
  40. data/lib/sisimai/lhost/postfix.rb +8 -11
  41. data/lib/sisimai/lhost/qmail.rb +5 -8
  42. data/lib/sisimai/lhost/sendmail.rb +7 -10
  43. data/lib/sisimai/lhost/v5sendmail.rb +15 -17
  44. data/lib/sisimai/lhost/verizon.rb +9 -14
  45. data/lib/sisimai/lhost/x1.rb +4 -6
  46. data/lib/sisimai/lhost/x2.rb +5 -7
  47. data/lib/sisimai/lhost/x3.rb +3 -4
  48. data/lib/sisimai/lhost/x6.rb +4 -6
  49. data/lib/sisimai/lhost/zoho.rb +6 -8
  50. data/lib/sisimai/lhost.rb +1 -1
  51. data/lib/sisimai/mail/mbox.rb +1 -1
  52. data/lib/sisimai/mail/memory.rb +1 -1
  53. data/lib/sisimai/mail.rb +8 -8
  54. data/lib/sisimai/message.rb +11 -13
  55. data/lib/sisimai/order.rb +12 -11
  56. data/lib/sisimai/reason/authfailure.rb +10 -10
  57. data/lib/sisimai/reason/badreputation.rb +4 -6
  58. data/lib/sisimai/reason/blocked.rb +6 -8
  59. data/lib/sisimai/reason/contenterror.rb +5 -6
  60. data/lib/sisimai/reason/delivered.rb +2 -2
  61. data/lib/sisimai/reason/exceedlimit.rb +7 -8
  62. data/lib/sisimai/reason/expired.rb +6 -7
  63. data/lib/sisimai/reason/failedstarttls.rb +5 -7
  64. data/lib/sisimai/reason/feedback.rb +2 -2
  65. data/lib/sisimai/reason/filtered.rb +7 -10
  66. data/lib/sisimai/reason/hasmoved.rb +4 -5
  67. data/lib/sisimai/reason/hostunknown.rb +6 -7
  68. data/lib/sisimai/reason/mailboxfull.rb +7 -8
  69. data/lib/sisimai/reason/mailererror.rb +5 -8
  70. data/lib/sisimai/reason/mesgtoobig.rb +5 -6
  71. data/lib/sisimai/reason/networkerror.rb +5 -8
  72. data/lib/sisimai/reason/norelaying.rb +4 -5
  73. data/lib/sisimai/reason/notaccept.rb +5 -8
  74. data/lib/sisimai/reason/notcompliantrfc.rb +5 -6
  75. data/lib/sisimai/reason/onhold.rb +6 -9
  76. data/lib/sisimai/reason/policyviolation.rb +6 -9
  77. data/lib/sisimai/reason/rejected.rb +5 -6
  78. data/lib/sisimai/reason/requireptr.rb +6 -7
  79. data/lib/sisimai/reason/securityerror.rb +6 -9
  80. data/lib/sisimai/reason/spamdetected.rb +8 -9
  81. data/lib/sisimai/reason/speeding.rb +6 -7
  82. data/lib/sisimai/reason/suppressed.rb +3 -7
  83. data/lib/sisimai/reason/suspend.rb +5 -7
  84. data/lib/sisimai/reason/syntaxerror.rb +3 -5
  85. data/lib/sisimai/reason/systemerror.rb +6 -9
  86. data/lib/sisimai/reason/systemfull.rb +5 -8
  87. data/lib/sisimai/reason/toomanyconn.rb +5 -6
  88. data/lib/sisimai/reason/undefined.rb +2 -2
  89. data/lib/sisimai/reason/userunknown.rb +8 -9
  90. data/lib/sisimai/reason/vacation.rb +4 -5
  91. data/lib/sisimai/reason/virusdetected.rb +4 -5
  92. data/lib/sisimai/reason.rb +13 -13
  93. data/lib/sisimai/rfc1123.rb +4 -8
  94. data/lib/sisimai/rfc1894.rb +5 -6
  95. data/lib/sisimai/rfc2045.rb +27 -31
  96. data/lib/sisimai/rfc3464/thirdparty.rb +1 -1
  97. data/lib/sisimai/rfc3464.rb +7 -9
  98. data/lib/sisimai/rfc3834.rb +5 -9
  99. data/lib/sisimai/rfc5322.rb +8 -26
  100. data/lib/sisimai/rfc791.rb +6 -4
  101. data/lib/sisimai/rhost/google.rb +8 -0
  102. data/lib/sisimai/rhost/microsoft.rb +17 -5
  103. data/lib/sisimai/rhost.rb +2 -2
  104. data/lib/sisimai/smtp/command.rb +1 -1
  105. data/lib/sisimai/smtp/failure.rb +5 -12
  106. data/lib/sisimai/smtp/reply.rb +33 -12
  107. data/lib/sisimai/smtp/status.rb +21 -22
  108. data/lib/sisimai/smtp/transcript.rb +1 -10
  109. data/lib/sisimai/string.rb +20 -30
  110. data/lib/sisimai/version.rb +1 -1
  111. data/lib/sisimai.rb +11 -11
  112. data/set-of-emails/maildir/bsd/rhost-microsoft-06.eml +45 -0
  113. metadata +8 -10
@@ -64,27 +64,26 @@ module Sisimai
64
64
 
65
65
  # Try to match that the given text and regular expressions
66
66
  # @param [String] argv1 String to be matched with regular expressions
67
- # @return [True,False] false: Did not match
68
- # true: Matched
67
+ # @return [Boolean] false: Did not match, true: Matched
69
68
  def match(argv1)
70
- return nil unless argv1
71
- return true if Index.any? { |a| argv1.include?(a) }
69
+ return false unless argv1
70
+ return true if Index.any? { |a| argv1.include?(a) }
72
71
  return false
73
72
  end
74
73
 
75
74
  # The envelope recipient's mailbox is full or not
76
75
  # @param [Sisimai::Fact] argvs Object to be detected the reason
77
- # @return [True,False] true: is mailbox full
76
+ # @return [Boolean] true: is mailbox full
78
77
  # false: is not mailbox full
79
78
  # @see http://www.ietf.org/rfc/rfc2822.txt
80
79
  def true(argvs)
81
- return nil if argvs['deliverystatus'].empty?
82
- return true if argvs['reason'] == 'mailboxfull'
80
+ return false if argvs['deliverystatus'].empty?
81
+ return true if argvs['reason'] == 'mailboxfull'
83
82
 
84
83
  # Delivery status code points "mailboxfull".
85
84
  # Status: 4.2.2
86
85
  # Diagnostic-Code: SMTP; 450 4.2.2 <***@example.jp>... Mailbox Full
87
- return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'mailboxfull'
86
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == 'mailboxfull'
88
87
  return match(argvs['diagnosticcode'].downcase)
89
88
  end
90
89
 
@@ -28,22 +28,19 @@ module Sisimai
28
28
 
29
29
  # Try to match that the given text and regular expressions
30
30
  # @param [String] argv1 String to be matched with regular expressions
31
- # @return [True,False] false: Did not match
32
- # true: Matched
31
+ # @return [Boolean] false: Did not match, true: Matched
33
32
  def match(argv1)
34
- return nil unless argv1
35
- return true if Index.any? { |a| argv1.include?(a) }
33
+ return false unless argv1
34
+ return true if Index.any? { |a| argv1.include?(a) }
36
35
  return false
37
36
  end
38
37
 
39
38
  # The bounce reason is mailer error or not
40
39
  # @param [Sisimai::Fact] argvs Object to be detected the reason
41
- # @return [True,False] true: is mailer error
40
+ # @return [Boolean] true: is mailer error
42
41
  # false: is not mailer error
43
42
  # @see http://www.ietf.org/rfc/rfc2822.txt
44
- def true(_argvs)
45
- return nil
46
- end
43
+ def true(_argvs); return false; end
47
44
 
48
45
  end
49
46
  end
@@ -27,24 +27,23 @@ module Sisimai
27
27
 
28
28
  # Try to match that the given text and regular expressions
29
29
  # @param [String] argv1 String to be matched with regular expressions
30
- # @return [True,False] false: Did not match
31
- # true: Matched
30
+ # @return [Boolean] false: Did not match, true: Matched
32
31
  def match(argv1)
33
- return nil unless argv1
34
- return true if Index.any? { |a| argv1.include?(a) }
32
+ return false unless argv1
33
+ return true if Index.any? { |a| argv1.include?(a) }
35
34
  return false
36
35
  end
37
36
 
38
37
  # The message size is too big for the remote host
39
38
  # @param [Sisimai::Fact] argvs Object to be detected the reason
40
- # @return [True,False] true: is too big message size
39
+ # @return [Boolean] true: is too big message size
41
40
  # false: is not big
42
41
  # @see http://www.ietf.org/rfc/rfc2822.txt
43
42
  def true(argvs)
44
43
  return true if argvs['reason'] == 'mesgtoobig'
45
44
 
46
45
  statuscode = argvs['deliverystatus'] || ''
47
- tempreason = Sisimai::SMTP::Status.name(statuscode) || ''
46
+ tempreason = Sisimai::SMTP::Status.name(statuscode)
48
47
 
49
48
  # Delivery status code points "mesgtoobig".
50
49
  # Status: 5.3.4
@@ -34,22 +34,19 @@ module Sisimai
34
34
 
35
35
  # Try to match that the given text and regular expressions
36
36
  # @param [String] argv1 String to be matched with regular expressions
37
- # @return [True,False] false: Did not match
38
- # true: Matched
37
+ # @return [Boolean] false: Did not match, true: Matched
39
38
  def match(argv1)
40
- return nil unless argv1
41
- return true if Index.any? { |a| argv1.include?(a) }
39
+ return false unless argv1
40
+ return true if Index.any? { |a| argv1.include?(a) }
42
41
  return false
43
42
  end
44
43
 
45
44
  # The bounce reason is network error or not
46
45
  # @param [Sisimai::Fact] argvs Object to be detected the reason
47
- # @return [True,False] true: is network error
46
+ # @return [Boolean] true: is network error
48
47
  # false: is not network error
49
48
  # @see http://www.ietf.org/rfc/rfc2822.txt
50
- def true(_argvs)
51
- return nil
52
- end
49
+ def true(_argvs); return false; end
53
50
 
54
51
  end
55
52
  end
@@ -37,17 +37,16 @@ module Sisimai
37
37
 
38
38
  # Try to match that the given text and regular expressions
39
39
  # @param [String] argv1 String to be matched with regular expressions
40
- # @return [True,False] false: Did not match
41
- # true: Matched
40
+ # @return [Boolean] false: Did not match, true: Matched
42
41
  def match(argv1)
43
- return nil unless argv1
44
- return true if Index.any? { |a| argv1.include?(a) }
42
+ return false unless argv1
43
+ return true if Index.any? { |a| argv1.include?(a) }
45
44
  return false
46
45
  end
47
46
 
48
47
  # Whether the message is rejected by 'Relaying denied'
49
48
  # @param [Sisimai::Fact] argvs Object to be detected the reason
50
- # @return [True,False] true: Rejected for "relaying denied"
49
+ # @return [Boolean] true: Rejected for "relaying denied"
51
50
  # false: is not
52
51
  # @see http://www.ietf.org/rfc/rfc2822.txt
53
52
  def true(argvs)
@@ -26,11 +26,10 @@ module Sisimai
26
26
 
27
27
  # Try to match that the given text and regular expressions
28
28
  # @param [String] argv1 String to be matched with regular expressions
29
- # @return [True,False] false: Did not match
30
- # true: Matched
29
+ # @return [Boolean] false: Did not match, true: Matched
31
30
  def match(argv1)
32
- return nil unless argv1
33
- return true if Index.any? { |a| argv1.include?(a) }
31
+ return false unless argv1
32
+ return true if Index.any? { |a| argv1.include?(a) }
34
33
  return false
35
34
  end
36
35
 
@@ -40,10 +39,8 @@ module Sisimai
40
39
  # false: Accept
41
40
  # @see http://www.ietf.org/rfc/rfc2822.txt
42
41
  def true(argvs)
43
- return true if argvs['reason'] == 'notaccept'
44
-
45
- # SMTP Reply Code is 554 or 556
46
- return true if [521, 554, 556].index(argvs['replycode'].to_i)
42
+ return true if argvs['reason'] == 'notaccept'
43
+ return true if [521, 556].index(argvs['replycode'].to_i) # SMTP Reply Code is 554 or 556
47
44
  return false if argvs['command'] != 'MAIL'
48
45
  return match(argvs['diagnosticcode'].downcase)
49
46
  end
@@ -23,18 +23,17 @@ module Sisimai
23
23
 
24
24
  # Try to match that the given text and regular expressions
25
25
  # @param [String] argv1 String to be matched with regular expressions
26
- # @return [True,False] false: Did not match
27
- # true: Matched
26
+ # @return [Boolean] false: Did not match, true: Matched
28
27
  def match(argv1)
29
- return nil unless argv1
30
- return true if Index.any? { |a| argv1.include?(a) }
31
- return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
28
+ return false unless argv1
29
+ return true if Index.any? { |a| argv1.include?(a) }
30
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
32
31
  return false
33
32
  end
34
33
 
35
34
  # Whether the email is RFC compliant or not
36
35
  # @param [Sisimai::Fact] argvs Object to be detected the reason
37
- # @return [True,False] true: RFC comliant
36
+ # @return [Boolean] true: RFC comliant
38
37
  # false: Is not RFC compliant
39
38
  # @see http://www.ietf.org/rfc/rfc5322.txt
40
39
  def true(argvs)
@@ -10,21 +10,18 @@ module Sisimai
10
10
 
11
11
  # Try to match that the given text and regular expressions
12
12
  # @param [String] argv1 String to be matched with regular expressions
13
- # @return [True,False] false: Did not match
14
- # true: Matched
15
- def match(_argv1)
16
- return false
17
- end
13
+ # @return [Boolean] false: Did not match, true: Matched
14
+ def match(_argv1); return false; end
18
15
 
19
16
  # On hold, Could not decide the bounce reason...
20
17
  # @param [Sisimai::Fact] argvs Object to be detected the reason
21
- # @return [True,False] true: Status code is "onhold"
18
+ # @return [Boolean] true: Status code is "onhold"
22
19
  # false: is not "onhold"
23
20
  # @see http://www.ietf.org/rfc/rfc2822.txt
24
21
  def true(argvs)
25
- return nil if argvs['deliverystatus'].empty?
26
- return true if argvs['reason'] == 'onhold'
27
- return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'onhold'
22
+ return false if argvs['deliverystatus'].empty?
23
+ return true if argvs['reason'] == 'onhold'
24
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == 'onhold'
28
25
  return false
29
26
  end
30
27
  end
@@ -50,25 +50,22 @@ module Sisimai
50
50
 
51
51
  # Try to match that the given text and regular expressions
52
52
  # @param [String] argv1 String to be matched with regular expressions
53
- # @return [True,False] false: Did not match
54
- # true: Matched
53
+ # @return [Boolean] false: Did not match, true: Matched
55
54
  # @since 4.22.0
56
55
  def match(argv1)
57
- return nil unless argv1
58
- return true if Index.any? { |a| argv1.include?(a) }
59
- return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
56
+ return false unless argv1
57
+ return true if Index.any? { |a| argv1.include?(a) }
58
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
60
59
  return false
61
60
  end
62
61
 
63
62
  # The bounce reason is "policyviolation" or not
64
63
  # @param [Sisimai::Fact] argvs Object to be detected the reason
65
- # @return [True,False] true: is policy violation
64
+ # @return [Boolean] true: is policy violation
66
65
  # false: is not policy violation
67
66
  # @since 4.22.0
68
67
  # @see http://www.ietf.org/rfc/rfc2822.txt
69
- def true(_argvs)
70
- return nil
71
- end
68
+ def true(_argvs); return false; end
72
69
 
73
70
  end
74
71
  end
@@ -81,10 +81,9 @@ module Sisimai
81
81
 
82
82
  # Try to match that the given text and regular expressions
83
83
  # @param [String] argv1 String to be matched with regular expressions
84
- # @return [True,False] false: Did not match
85
- # true: Matched
84
+ # @return [Boolean] false: Did not match, true: Matched
86
85
  def match(argv1)
87
- return nil unless argv1
86
+ return false unless argv1
88
87
  return false if IsNot.any? { |a| argv1.include?(a) }
89
88
  return true if Index.any? { |a| argv1.include?(a) }
90
89
  return false
@@ -92,12 +91,12 @@ module Sisimai
92
91
 
93
92
  # Rejected by the envelope sender address or not
94
93
  # @param [Sisimai::Fact] argvs Object to be detected the reason
95
- # @return [True,False] true: is rejected
94
+ # @return [Boolean] true: is rejected
96
95
  # false: is not rejected by the sender
97
96
  # @see http://www.ietf.org/rfc/rfc2822.txt
98
97
  def true(argvs)
99
98
  return true if argvs['reason'] == 'rejected'
100
- tempreason = Sisimai::SMTP::Status.name(argvs['deliverystatus']) || 'undefined'
99
+ tempreason = Sisimai::SMTP::Status.name(argvs['deliverystatus'])
101
100
  return true if tempreason == 'rejected' # Delivery status code points "rejected".
102
101
 
103
102
  # Check the value of Diagnosic-Code: header with patterns
@@ -113,7 +112,7 @@ module Sisimai
113
112
  # Except "userunknown"
114
113
  return true if match(issuedcode)
115
114
  end
116
- elsif %w[onhold undefined securityerror systemerror].include?(tempreason)
115
+ elsif %w[onhold undefined securityerror systemerror].include?(tempreason) || tempreason == ""
117
116
  # Try to match with message patterns when the temporary reason is "onhold", "undefined",
118
117
  # "securityerror", or "systemerror"
119
118
  return true if match(issuedcode)
@@ -42,23 +42,22 @@ module Sisimai
42
42
 
43
43
  # Try to match that the given text and regular expressions
44
44
  # @param [String] argv1 String to be matched with regular expressions
45
- # @return [True,False] false: Did not match
46
- # true: Matched
45
+ # @return [Boolean] false: Did not match, true: Matched
47
46
  def match(argv1)
48
- return nil unless argv1
49
- return true if Index.any? { |a| argv1.include?(a) }
50
- return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
47
+ return false unless argv1
48
+ return true if Index.any? { |a| argv1.include?(a) }
49
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
51
50
  return false
52
51
  end
53
52
 
54
53
  # Check the email rejected due to missing PTR record or having invalid PTR record OR not
55
54
  # @param [Hash] argvs Hash to be detected the value of reason
56
- # @return [true,false] true: is missing PTR or invalid PTR
55
+ # @return [Boolean] true: is missing PTR or invalid PTR
57
56
  # false: is not blocked due to missing PTR record
58
57
  # @see http://www.ietf.org/rfc/rfc5322.txt
59
58
  def true(argvs)
60
59
  return true if argvs['reason'] == 'requireptr'
61
- return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'requireptr'
60
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == 'requireptr'
62
61
  return match(argvs['diagnosticcode'].downcase)
63
62
  end
64
63
 
@@ -46,23 +46,20 @@ module Sisimai
46
46
 
47
47
  # Try to match that the given text and regular expressions
48
48
  # @param [String] argv1 String to be matched with regular expressions
49
- # @return [True,False] false: Did not match
50
- # true: Matched
49
+ # @return [Boolean] false: Did not match, true: Matched
51
50
  def match(argv1)
52
- return nil unless argv1
53
- return true if Index.any? { |a| argv1.include?(a) }
54
- return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
51
+ return false unless argv1
52
+ return true if Index.any? { |a| argv1.include?(a) }
53
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
55
54
  return false
56
55
  end
57
56
 
58
57
  # The bounce reason is SecurityError or not
59
58
  # @param [Sisimai::Fact] argvs Object to be detected the reason
60
- # @return [True,False] true: is security error
59
+ # @return [Boolean] true: is security error
61
60
  # false: is not security error
62
61
  # @see http://www.ietf.org/rfc/rfc2822.txt
63
- def true(_argvs)
64
- return nil
65
- end
62
+ def true(_argvs); return false; end
66
63
 
67
64
  end
68
65
  end
@@ -120,24 +120,23 @@ module Sisimai
120
120
 
121
121
  # Try to match that the given text and regular expressions
122
122
  # @param [String] argv1 String to be matched with regular expressions
123
- # @return [True,False] false: Did not match
124
- # true: Matched
123
+ # @return [Boolean] false: Did not match, true: Matched
125
124
  def match(argv1)
126
- return nil unless argv1
127
- return true if Index.any? { |a| argv1.include?(a) }
128
- return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
125
+ return false unless argv1
126
+ return true if Index.any? { |a| argv1.include?(a) }
127
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
129
128
  return false
130
129
  end
131
130
 
132
131
  # Rejected due to spam content in the message
133
132
  # @param [Sisimai::Fact] argvs Object to be detected the reason
134
- # @return [True,False] true: rejected due to spam
133
+ # @return [Boolean] true: rejected due to spam
135
134
  # false: is not rejected due to spam
136
135
  # @see http://www.ietf.org/rfc/rfc2822.txt
137
136
  def true(argvs)
138
- return nil if argvs['deliverystatus'].empty?
139
- return true if argvs['reason'] == 'spamdetected'
140
- return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'spamdetected'
137
+ return false if argvs['deliverystatus'].empty?
138
+ return true if argvs['reason'] == 'spamdetected'
139
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == 'spamdetected'
141
140
 
142
141
  # The value of "reason" isn't "spamdetected" when the value of "command" is an SMTP command
143
142
  # to be sent before the SMTP DATA command because all the MTAs read the headers and the
@@ -16,22 +16,21 @@ module Sisimai
16
16
 
17
17
  # Try to match that the given text and regular expressions
18
18
  # @param [String] argv1 String to be matched with regular expressions
19
- # @return [True,False] false: Did not match
20
- # true: Matched
19
+ # @return [Boolean] false: Did not match, true: Matched
21
20
  def match(argv1)
22
- return nil unless argv1
23
- return true if Index.any? { |a| argv1.include?(a) }
21
+ return false unless argv1
22
+ return true if Index.any? { |a| argv1.include?(a) }
24
23
  return false
25
24
  end
26
25
 
27
26
  # Speeding or not
28
27
  # @param [Sisimai::Fact] argvs Object to be detected the reason
29
- # @return [True,False] true: is speeding
28
+ # @return [Boolean] true: is speeding
30
29
  # false: is not speeding
31
30
  # @see http://www.ietf.org/rfc/rfc2822.txt
32
31
  def true(argvs)
33
- return nil if argvs['deliverystatus'].empty?
34
- return true if argvs['reason'] == 'speeding'
32
+ return false if argvs['deliverystatus'].empty?
33
+ return true if argvs['reason'] == 'speeding'
35
34
 
36
35
  # Action: failed
37
36
  # Status: 4.7.1
@@ -12,16 +12,12 @@ module Sisimai
12
12
 
13
13
  # Try to match that the given text and regular expressions
14
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
15
+ # @return [Boolean] false: Did not match, true: Matched
16
+ def match(argv1); return false; end
21
17
 
22
18
  # Whether the address is listed in the suppression list
23
19
  # @param [Sisimai::Fact] argvs Object to be detected the reason
24
- # @return [True,False] true: The address is listed in the suppression list
20
+ # @return [Boolean] true: The address is listed in the suppression list
25
21
  # false: is not listed in the suppression list
26
22
  # @see http://www.ietf.org/rfc/rfc2822.txt
27
23
  def true(argvs)
@@ -36,22 +36,20 @@ module Sisimai
36
36
 
37
37
  # Try to match that the given text and regular expressions
38
38
  # @param [String] argv1 String to be matched with regular expressions
39
- # @return [True,False] false: Did not match
40
- # true: Matched
39
+ # @return [Boolean] false: Did not match, true: Matched
41
40
  def match(argv1)
42
- return nil unless argv1
43
- return true if Index.any? { |a| argv1.include?(a) }
41
+ return false unless argv1
42
+ return true if Index.any? { |a| argv1.include?(a) }
44
43
  return false
45
44
  end
46
45
 
47
46
  # The envelope recipient's mailbox is suspended or not
48
47
  # @param [Sisimai::Fact] argvs Object to be detected the reason
49
- # @return [True,False] true: is mailbox suspended
48
+ # @return [Boolean] true: is mailbox suspended
50
49
  # false: is not suspended
51
50
  # @see http://www.ietf.org/rfc/rfc2822.txt
52
51
  def true(argvs)
53
- return true if argvs['reason'] == 'suspend'
54
- return true if argvs['replycode'].to_i == 525
52
+ return true if argvs['reason'] == 'suspend' || argvs['replycode'].to_i == 525
55
53
  return match(argvs['diagnosticcode'].downcase)
56
54
  end
57
55
 
@@ -14,12 +14,11 @@ module Sisimai
14
14
  class << self
15
15
  def text; return 'syntaxerror'; end
16
16
  def description; return 'Email rejected due to syntax error at sent commands in SMTP session'; end
17
- def match(*); return nil; end
17
+ def match(*); return false; end
18
18
 
19
19
  # Connection rejected due to syntax error or not
20
20
  # @param [Sisimai::Fact] argvs Object to be detected the reason
21
- # @return [True,False] true: Connection rejected due to
22
- # syntax error
21
+ # @return [Boolean] true: Connection rejected due to syntax error
23
22
  # false: is not syntax error
24
23
  # @since 4.1.25
25
24
  # @see http://www.ietf.org/rfc/rfc2822.txt
@@ -27,8 +26,7 @@ module Sisimai
27
26
  return true if argvs['reason'] == 'syntaxerror'
28
27
 
29
28
  reply = argvs['replycode'].to_i
30
- return true if reply > 400 && reply < 408
31
- return true if reply > 500 && reply < 508
29
+ return true if reply > 400 && reply < 408 || reply > 500 && reply < 508
32
30
  return false
33
31
  end
34
32
 
@@ -43,23 +43,20 @@ module Sisimai
43
43
 
44
44
  # Try to match that the given text and regular expressions
45
45
  # @param [String] argv1 String to be matched with regular expressions
46
- # @return [True,False] false: Did not match
47
- # true: Matched
46
+ # @return [Boolean] false: Did not match, true: Matched
48
47
  def match(argv1)
49
- return nil unless argv1
50
- return true if Index.any? { |a| argv1.include?(a) }
51
- return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
48
+ return false unless argv1
49
+ return true if Index.any? { |a| argv1.include?(a) }
50
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
52
51
  return false
53
52
  end
54
53
 
55
54
  # The bounce reason is system error or not
56
55
  # @param [Sisimai::Fact] argvs Object to be detected the reason
57
- # @return [True,False] true: is system error
56
+ # @return [Boolean] true: is system error
58
57
  # false: is not system error
59
58
  # @see http://www.ietf.org/rfc/rfc2822.txt
60
- def true(_argvs)
61
- return nil
62
- end
59
+ def true(_argvs); return false; end
63
60
 
64
61
  end
65
62
  end
@@ -18,22 +18,19 @@ module Sisimai
18
18
 
19
19
  # Try to match that the given text and regular expressions
20
20
  # @param [String] argv1 String to be matched with regular expressions
21
- # @return [True,False] false: Did not match
22
- # true: Matched
21
+ # @return [Boolean] false: Did not match, true: Matched
23
22
  def match(argv1)
24
- return nil unless argv1
25
- return true if Index.any? { |a| argv1.include?(a) }
23
+ return false unless argv1
24
+ return true if Index.any? { |a| argv1.include?(a) }
26
25
  return false
27
26
  end
28
27
 
29
28
  # The bounce reason is system full or not
30
29
  # @param [Sisimai::Fact] argvs Object to be detected the reason
31
- # @return [True,False] true: is system full
30
+ # @return [Boolean] true: is system full
32
31
  # false: is not system full
33
32
  # @see http://www.ietf.org/rfc/rfc2822.txt
34
- def true(_argvs)
35
- return nil
36
- end
33
+ def true(_argvs); return false; end
37
34
 
38
35
  end
39
36
  end
@@ -32,22 +32,21 @@ module Sisimai
32
32
 
33
33
  # Try to match that the given text and regular expressions
34
34
  # @param [String] argv1 String to be matched with regular expressions
35
- # @return [True,False] false: Did not match
36
- # true: Matched
35
+ # @return [Boolean] false: Did not match, true: Matched
37
36
  def match(argv1)
38
- return nil unless argv1
39
- return true if Index.any? { |a| argv1.include?(a) }
37
+ return false unless argv1
38
+ return true if Index.any? { |a| argv1.include?(a) }
40
39
  return false
41
40
  end
42
41
 
43
42
  # Rejected by domain or address filter ?
44
43
  # @param [Sisimai::Fact] argvs Object to be detected the reason
45
- # @return [True,False] true: is filtered
44
+ # @return [Boolean] true: is filtered
46
45
  # false: is not filtered
47
46
  # @see http://www.ietf.org/rfc/rfc2822.txt
48
47
  def true(argvs)
49
48
  return true if argvs['reason'] == 'toomanyconn'
50
- return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']).to_s == 'toomanyconn'
49
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == 'toomanyconn'
51
50
  return match(argvs['diagnosticcode'].downcase)
52
51
  end
53
52
 
@@ -6,8 +6,8 @@ module Sisimai
6
6
  class << self
7
7
  def text; return 'undefined'; end
8
8
  def description; return 'Sisimai could not detect an error reason'; end
9
- def match; return nil; end
10
- def true(*); return nil; end
9
+ def match; return false; end
10
+ def true(*); return false; end
11
11
  end
12
12
  end
13
13
  end