sisimai 5.7.0-java → 5.7.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 (102) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/codecovio.yml +1 -1
  3. data/.github/workflows/rake-test.yml +1 -1
  4. data/ChangeLog.md +25 -0
  5. data/README-JA.md +14 -13
  6. data/README.md +12 -12
  7. data/lib/sisimai/arf.rb +2 -1
  8. data/lib/sisimai/eb.rb +116 -0
  9. data/lib/sisimai/fact.rb +24 -17
  10. data/lib/sisimai/lda.rb +20 -18
  11. data/lib/sisimai/lhost/amazonses.rb +11 -10
  12. data/lib/sisimai/lhost/courier.rb +4 -3
  13. data/lib/sisimai/lhost/domino.rb +2 -1
  14. data/lib/sisimai/lhost/einsundeins.rb +3 -2
  15. data/lib/sisimai/lhost/exchange2003.rb +8 -7
  16. data/lib/sisimai/lhost/exchange2007.rb +14 -13
  17. data/lib/sisimai/lhost/exim.rb +7 -6
  18. data/lib/sisimai/lhost/ezweb.rb +4 -3
  19. data/lib/sisimai/lhost/fml.rb +4 -3
  20. data/lib/sisimai/lhost/gmail.rb +10 -9
  21. data/lib/sisimai/lhost/googlegroups.rb +3 -2
  22. data/lib/sisimai/lhost/googleworkspace.rb +2 -1
  23. data/lib/sisimai/lhost/imailserver.rb +3 -2
  24. data/lib/sisimai/lhost/kddi.rb +4 -3
  25. data/lib/sisimai/lhost/notes.rb +2 -1
  26. data/lib/sisimai/lhost/postfix.rb +7 -6
  27. data/lib/sisimai/lhost/qmail.rb +10 -9
  28. data/lib/sisimai/lhost/sendmail.rb +4 -3
  29. data/lib/sisimai/lhost/trendmicro.rb +2 -1
  30. data/lib/sisimai/lhost/v5sendmail.rb +2 -1
  31. data/lib/sisimai/lhost/verizon.rb +3 -2
  32. data/lib/sisimai/message.rb +5 -6
  33. data/lib/sisimai/reason/authfailure.rb +6 -5
  34. data/lib/sisimai/reason/badreputation.rb +5 -4
  35. data/lib/sisimai/reason/blocked.rb +6 -5
  36. data/lib/sisimai/reason/contenterror.rb +6 -5
  37. data/lib/sisimai/reason/delivered.rb +3 -2
  38. data/lib/sisimai/reason/emailtoolarge.rb +6 -5
  39. data/lib/sisimai/reason/expired.rb +3 -2
  40. data/lib/sisimai/reason/failedstarttls.rb +5 -3
  41. data/lib/sisimai/reason/feedback.rb +2 -1
  42. data/lib/sisimai/reason/filtered.rb +9 -8
  43. data/lib/sisimai/reason/hasmoved.rb +5 -4
  44. data/lib/sisimai/reason/hostunknown.rb +5 -4
  45. data/lib/sisimai/reason/mailboxfull.rb +7 -6
  46. data/lib/sisimai/reason/mailererror.rb +3 -2
  47. data/lib/sisimai/reason/networkerror.rb +3 -2
  48. data/lib/sisimai/reason/norelaying.rb +4 -3
  49. data/lib/sisimai/reason/notaccept.rb +5 -4
  50. data/lib/sisimai/reason/notcompliantrfc.rb +4 -3
  51. data/lib/sisimai/reason/onhold.rb +8 -7
  52. data/lib/sisimai/reason/policyviolation.rb +7 -6
  53. data/lib/sisimai/reason/ratelimited.rb +5 -4
  54. data/lib/sisimai/reason/rejected.rb +18 -14
  55. data/lib/sisimai/reason/requireptr.rb +5 -4
  56. data/lib/sisimai/reason/securityerror.rb +4 -3
  57. data/lib/sisimai/reason/spamdetected.rb +6 -5
  58. data/lib/sisimai/reason/suppressed.rb +4 -3
  59. data/lib/sisimai/reason/suspend.rb +4 -3
  60. data/lib/sisimai/reason/syntaxerror.rb +4 -3
  61. data/lib/sisimai/reason/systemerror.rb +3 -2
  62. data/lib/sisimai/reason/systemfull.rb +4 -3
  63. data/lib/sisimai/reason/undefined.rb +2 -1
  64. data/lib/sisimai/reason/userunknown.rb +13 -9
  65. data/lib/sisimai/reason/vacation.rb +2 -1
  66. data/lib/sisimai/reason/virusdetected.rb +6 -5
  67. data/lib/sisimai/reason.rb +45 -40
  68. data/lib/sisimai/rfc1894.rb +8 -2
  69. data/lib/sisimai/rfc2045.rb +6 -3
  70. data/lib/sisimai/rfc3464/thirdparty.rb +10 -9
  71. data/lib/sisimai/rfc3834.rb +4 -2
  72. data/lib/sisimai/rhost/aol.rb +3 -2
  73. data/lib/sisimai/rhost/apple.rb +12 -11
  74. data/lib/sisimai/rhost/cloudflare.rb +3 -2
  75. data/lib/sisimai/rhost/cox.rb +38 -37
  76. data/lib/sisimai/rhost/facebook.rb +17 -16
  77. data/lib/sisimai/rhost/franceptt.rb +39 -38
  78. data/lib/sisimai/rhost/godaddy.rb +35 -34
  79. data/lib/sisimai/rhost/google.rb +22 -21
  80. data/lib/sisimai/rhost/gsuite.rb +8 -7
  81. data/lib/sisimai/rhost/iua.rb +11 -10
  82. data/lib/sisimai/rhost/kddi.rb +3 -2
  83. data/lib/sisimai/rhost/messagelabs.rb +13 -12
  84. data/lib/sisimai/rhost/microsoft.rb +33 -32
  85. data/lib/sisimai/rhost/mimecast.rb +18 -17
  86. data/lib/sisimai/rhost/nttdocomo.rb +10 -9
  87. data/lib/sisimai/rhost/outlook.rb +3 -2
  88. data/lib/sisimai/rhost/spectrum.rb +19 -18
  89. data/lib/sisimai/rhost/tencent.rb +10 -9
  90. data/lib/sisimai/rhost/yahooinc.rb +11 -10
  91. data/lib/sisimai/rhost/zoho.rb +8 -7
  92. data/lib/sisimai/smtp/command.rb +13 -8
  93. data/lib/sisimai/smtp/failure.rb +9 -8
  94. data/lib/sisimai/smtp/reply.rb +23 -22
  95. data/lib/sisimai/smtp/status.rb +141 -140
  96. data/lib/sisimai/smtp/transcript.rb +3 -2
  97. data/lib/sisimai/string.rb +4 -3
  98. data/lib/sisimai/version.rb +1 -1
  99. data/lib/sisimai.rb +2 -1
  100. data/set-of-emails/maildir/bsd/lhost-postfix-81.eml +130 -0
  101. data/set-of-emails/should-not-crash/go-423-deeply-nested-mime-parts.eml +20050 -0
  102. metadata +5 -2
@@ -1,6 +1,6 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::BadReputation checks the bounce reason is "badreputation" or not. This class
3
+ # Sisimai::Reason::BadReputation checks the bounce reason is "BadReputation" or not. This class
4
4
  # is called only Sisimai::Reason class.
5
5
  #
6
6
  # This is the error that an email rejected due to a reputation score of the sender IP address.
@@ -14,6 +14,7 @@ module Sisimai
14
14
  # visit https://support.google.com/mail/answer/188131 for more information.
15
15
  module BadReputation
16
16
  class << self
17
+ require 'sisimai/eb'
17
18
  Index = [
18
19
  "has been temporarily rate limited due to ip reputation",
19
20
  "ip/domain reputation problems",
@@ -23,7 +24,7 @@ module Sisimai
23
24
  "sending mta's poor reputation",
24
25
  "temporarily deferred due to unexpected volume or user complaints", # Yahoo Inc.
25
26
  ].freeze
26
- def text; return 'badreputation'; end
27
+ def text; return Sisimai::Eb::ReFAMA; end
27
28
  def description; return 'Email rejected due to an IP address reputation'; end
28
29
 
29
30
  # Try to match that the given text and regular expressions
@@ -35,12 +36,12 @@ module Sisimai
35
36
  return false
36
37
  end
37
38
 
38
- # The bounce reason is "badreputation" or not
39
+ # The bounce reason is "BadReputation" or not
39
40
  # @param [Sisimai::Fact] argvs Object to be detected the reason
40
41
  # @return [Boolean] true: is BadReputation, false: is not BadReputation
41
42
  # @see http://www.ietf.org/rfc/rfc2822.txt
42
43
  def true(argvs)
43
- return true if argvs['reason'] == 'badreputation'
44
+ return true if argvs['reason'] == Sisimai::Eb::ReFAMA
44
45
  return match(argvs['diagnosticcode'].downcase)
45
46
  end
46
47
 
@@ -1,12 +1,13 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::Blocked checks the bounce reason is "blocked" or not. This class is called
3
+ # Sisimai::Reason::Blocked checks the bounce reason is "Blocked" or not. This class is called
4
4
  # only Sisimai::Reason class.
5
5
  #
6
6
  # This is the error that SMTP connection was rejected due to a client IP address or a hostname,
7
7
  # or the parameter of "HELO/EHLO" command. This reason has added in Sisimai 4.0.0.
8
8
  module Blocked
9
9
  class << self
10
+ require 'sisimai/eb'
10
11
  Index = [
11
12
  "bad sender ip address",
12
13
  "banned sending ip", # Office365
@@ -70,7 +71,7 @@ module Sisimai
70
71
  ["your sender's ip address is listed at ", ".abuseat.org"],
71
72
  ].freeze
72
73
 
73
- def text; return 'blocked'; end
74
+ def text; return Sisimai::Eb::ReBLOC; end
74
75
  def description; return 'Email rejected due to client IP address or a hostname'; end
75
76
 
76
77
  # Try to match that the given text and regular expressions
@@ -85,11 +86,11 @@ module Sisimai
85
86
 
86
87
  # Blocked due to client IP address or hostname
87
88
  # @param [Hash] argvs Hash to be detected the value of reason
88
- # @return [Boolean] true: is blocked, false: is not blocked by the client
89
+ # @return [Boolean] true: is Blocked, false: is not Blocked by the client
89
90
  # @see http://www.ietf.org/rfc/rfc2822.txt
90
91
  def true(argvs)
91
- return true if argvs['reason'] == 'blocked'
92
- return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == 'blocked'
92
+ return true if argvs['reason'] == Sisimai::Eb::ReBLOC
93
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == Sisimai::Eb::ReBLOC
93
94
  return match(argvs['diagnosticcode'].downcase)
94
95
  end
95
96
 
@@ -1,13 +1,14 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::ContentError checks the bounce reason is "contenterror" or not This class is
3
+ # Sisimai::Reason::ContentError checks the bounce reason is "ContentError" or not This class is
4
4
  # called only Sisimai::Reason class.
5
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
7
+ # email like the following. Sisimai will set "ContentError" to the reason of email bounce if the
8
8
  # value of Status: field in a bounce email is "5.6.*".
9
9
  module ContentError
10
10
  class << self
11
+ require 'sisimai/eb'
11
12
  Index = [
12
13
  "charset not supported",
13
14
  "executable files are not allowed in compressed files",
@@ -27,7 +28,7 @@ module Sisimai
27
28
  "we do not accept messages containing images or other attachments",
28
29
  ].freeze
29
30
 
30
- def text; return 'contenterror'; end
31
+ def text; return Sisimai::Eb::ReBODY; end
31
32
  def description; return 'Email rejected due to a header format of the email'; end
32
33
 
33
34
  # Try to match that the given text and regular expressions
@@ -46,9 +47,9 @@ module Sisimai
46
47
  # @see http://www.ietf.org/rfc/rfc2822.txt
47
48
  def true(argvs)
48
49
  require 'sisimai/reason/spamdetected'
49
- return true if argvs["reason"] == "blocked"
50
+ return true if argvs["reason"] == Sisimai::Eb::ReBLOC
50
51
  return false if Sisimai::Reason::SpamDetected.true(argvs)
51
- return true if Sisimai::SMTP::Status.name(argvs["deliverystatus"]) == "contenterror"
52
+ return true if Sisimai::SMTP::Status.name(argvs["deliverystatus"]) == Sisimai::Eb::ReBODY
52
53
  return match(argvs["diagnosticcode"].downcase)
53
54
  end
54
55
 
@@ -1,7 +1,7 @@
1
1
  module Sisimai
2
2
  module Reason
3
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"
4
+ # diagnostic messages with message patterns. Sisimai will set "Delivered" to the value of "reason"
5
5
  # when Status: field in the bounce message begins with "2" like following:
6
6
  #
7
7
  # Final-Recipient: rfc822; kijitora@neko.nyaan.jp
@@ -12,7 +12,8 @@ module Sisimai
12
12
  # This class is called only Sisimai.reason method. This is NOT AN ERROR reason.
13
13
  module Delivered
14
14
  class << self
15
- def text; return 'delivered'; end
15
+ require 'sisimai/eb'
16
+ def text; return Sisimai::Eb::ReSENT; end
16
17
  def description; return 'Email delivered successfully'; end
17
18
  def match; return false; end
18
19
  def true(*); return false; end
@@ -2,10 +2,11 @@ module Sisimai
2
2
  module Reason
3
3
  # This is the error that a sent email size is too big for a destination mail server. In many
4
4
  # case, There are many attachment files with email, or the file size is too large. Sisimai will
5
- # set "emailtoolarge" to the reason of email bounce if the value of Status: field in a bounce
5
+ # set "EmailTooLarge" to the reason of email bounce if the value of Status: field in a bounce
6
6
  # email is "5.2.3" or "5.3.4".
7
7
  module EmailTooLarge
8
8
  class << self
9
+ require 'sisimai/eb'
9
10
  Index = [
10
11
  "exceeds the maximum size ",
11
12
  "line limit exceeded",
@@ -20,7 +21,7 @@ module Sisimai
20
21
  ["message ", "too", "big"],
21
22
  ].freeze
22
23
 
23
- def text; return 'emailtoolarge'; end
24
+ def text; return Sisimai::Eb::ReSIZE; end
24
25
  def description; return 'Email rejected due to an email size is too big for a destination mail server'; end
25
26
 
26
27
  # Try to match that the given text and regular expressions
@@ -39,18 +40,18 @@ module Sisimai
39
40
  # false: is not big
40
41
  # @see http://www.ietf.org/rfc/rfc2822.txt
41
42
  def true(argvs)
42
- return true if argvs['reason'] == 'emailtoolarge'
43
+ return true if argvs['reason'] == Sisimai::Eb::ReSIZE
43
44
 
44
45
  statuscode = argvs['deliverystatus'] || ''
45
46
  tempreason = Sisimai::SMTP::Status.name(statuscode)
46
47
 
47
- # Delivery status code points "emailtoolarge".
48
+ # Delivery status code points "EmailTooLarge".
48
49
  # Status: 5.3.4
49
50
  # Diagnostic-Code: SMTP; 552 5.3.4 Error: message file too big
50
51
  #
51
52
  # Status: 5.2.3
52
53
  # Deiagnostic-Code: Message length exceeds administrative limit
53
- return true if tempreason == 'emailtoolarge'
54
+ return true if tempreason == Sisimai::Eb::ReSIZE
54
55
  return match(argvs['diagnosticcode'].downcase)
55
56
  end
56
57
 
@@ -1,12 +1,13 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::Expired checks the bounce reason is "expired" or not. This class is called only
3
+ # Sisimai::Reason::Expired checks the bounce reason is "Expired" or not. This class is called only
4
4
  # Sisimai::Reason class.
5
5
  #
6
6
  # This is the error that delivery time has expired due to connection failure or network error and
7
7
  # the message you sent has been in the queue for long time.
8
8
  module Expired
9
9
  class << self
10
+ require 'sisimai/eb'
10
11
  Index = [
11
12
  "connection timed out",
12
13
  "could not find a gateway for",
@@ -39,7 +40,7 @@ module Sisimai
39
40
  ["not", "reach", "period"], # Exim/smtp.c:3508
40
41
  ].freeze
41
42
 
42
- def text; return 'expired'; end
43
+ def text; return Sisimai::Eb::ReTIME; end
43
44
  def description; return 'Delivery time has expired due to a connection failure'; end
44
45
 
45
46
  # Try to match that the given text and regular expressions
@@ -1,16 +1,18 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::FailedSTARTTLS checks the bounce reason is "failedstarttls" or not.
3
+ # Sisimai::Reason::FailedSTARTTLS checks the bounce reason is "FailedSTARTTLS" or not.
4
4
  # This class is called only Sisimai::Reason class.
5
5
  module FailedSTARTTLS
6
6
  class << self
7
+ require 'sisimai/eb'
8
+
7
9
  # Email delivery failed due to STARTTLS related problem
8
10
  Index = [
9
11
  'starttls is required to send mail',
10
12
  'tls required but not supported', # SendGrid:the recipient mailserver does not support TLS or have a valid certificate
11
13
  ].freeze
12
14
 
13
- def text; return 'failedstarttls'; end
15
+ def text; return Sisimai::Eb::ReTTLS; end
14
16
  def description; return "Email delivery failed due to STARTTLS related problem"; end
15
17
 
16
18
  # Try to match that the given text and regular expressions
@@ -28,7 +30,7 @@ module Sisimai
28
30
  # false: Not FailedSTARTTLS
29
31
  # @see http://www.ietf.org/rfc/rfc2822.txt
30
32
  def true(argvs)
31
- return true if argvs["reason"] == "failedstarttls" || argvs["command"] == "STARTTLS"
33
+ return true if argvs["reason"] == Sisimai::Eb::ReTTLS || argvs["command"] == Sisimai::Eb::CeTTLS
32
34
  return true if [523, 524, 538].index(argvs["replycode"].to_i)
33
35
  return match(argvs["diagnosticcode"].downcase)
34
36
  end
@@ -4,7 +4,8 @@ module Sisimai
4
4
  # from Sisimai.reason method and Sisimai::ARF class.
5
5
  module Feedback
6
6
  class << self
7
- def text; return 'feedback'; end
7
+ require 'sisimai/eb'
8
+ def text; return Sisimai::Eb::ReFEED; end
8
9
  def description; return 'Email forwarded to the sender as a complaint message from your mailbox provider'; end
9
10
  def match; return false; end
10
11
  def true(*); return false; end
@@ -1,14 +1,15 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::Filtered checks the bounce reason is "filtered" or not. This class is called
3
+ # Sisimai::Reason::Filtered checks the bounce reason is "Filtered" or not. This class is called
4
4
  # only Sisimai::Reason class.
5
5
  #
6
6
  # This is the error that an email has been rejected by a header content after SMTP DATA command.
7
7
  # In Japanese cellular phones, the error will incur that a sender's email address or a domain
8
- # is rejected by recipient's email configuration. Sisimai will set "filtered" to the reason of
8
+ # is rejected by recipient's email configuration. Sisimai will set "Filtered" to the reason of
9
9
  # email bounce if the value of Status: field in a bounce email is "5.2.0" or "5.2.1".
10
10
  module Filtered
11
11
  class << self
12
+ require 'sisimai/eb'
12
13
  Index = [
13
14
  "account is protected by",
14
15
  "has restricted sms e-mail", # AT&T
@@ -24,7 +25,7 @@ module Sisimai
24
25
  "you have been blocked by the recipient",
25
26
  ].freeze
26
27
 
27
- def text; return 'filtered'; end
28
+ def text; return Sisimai::Eb::ReFILT; end
28
29
  def description; return 'Email rejected due to a header content after SMTP DATA command'; end
29
30
 
30
31
  # Try to match that the given text and regular expressions
@@ -42,19 +43,19 @@ module Sisimai
42
43
  # false: is not filtered
43
44
  # @see http://www.ietf.org/rfc/rfc2822.txt
44
45
  def true(argvs)
45
- return true if argvs['reason'] == 'filtered'
46
+ return true if argvs['reason'] == Sisimai::Eb::ReFILT
46
47
 
47
48
  tempreason = Sisimai::SMTP::Status.name(argvs['deliverystatus'])
48
- return false if tempreason == 'suspend'
49
+ return false if tempreason == Sisimai::Eb::ReQUIT
49
50
 
50
51
  issuedcode = argvs['diagnosticcode'].downcase || ''
51
52
  thecommand = argvs['command'] || ''
52
- if tempreason == 'filtered'
53
- # Delivery status code points "filtered".
53
+ if tempreason == Sisimai::Eb::ReFILT
54
+ # Delivery status code points "Filtered".
54
55
  require 'sisimai/reason/userunknown'
55
56
  return true if Sisimai::Reason::UserUnknown.match(issuedcode) || match(issuedcode)
56
57
  else
57
- # The value of "reason" isn't "filtered" when the value of "command" is an SMTP command
58
+ # The value of "reason" isn't "Filtered" when the value of "command" is an SMTP command
58
59
  # to be sent before the SMTP DATA command because all the MTAs read the headers and the
59
60
  # entire message body after the DATA command.
60
61
  return false if Sisimai::SMTP::Command::ExceptDATA.include?(thecommand)
@@ -1,16 +1,17 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::HasMoved checks the bounce reason is "hasmoved" or not. This class is called
3
+ # Sisimai::Reason::HasMoved checks the bounce reason is "HasMoved" or not. This class is called
4
4
  # only Sisimai::Reason class.
5
5
  #
6
6
  # This is the error that a user's mailbox has moved (and is not forwarded automatically). Sisimai
7
- # will set "hasmoved" to the reason of email bounce if the value of Status: field in a bounce email
7
+ # will set "HasMoved" to the reason of email bounce if the value of Status: field in a bounce email
8
8
  # is "5.1.6".
9
9
  module HasMoved
10
10
  class << self
11
+ require 'sisimai/eb'
11
12
  Index = [' has been replaced by '].freeze
12
13
 
13
- def text; return 'hasmoved'; end
14
+ def text; return Sisimai::Eb::ReMOVE; end
14
15
  def description; return "Email rejected due to user's mailbox has moved and is not forwarded automatically"; end
15
16
 
16
17
  # Try to match that the given text and regular expressions
@@ -28,7 +29,7 @@ module Sisimai
28
29
  # false: Has not moved
29
30
  # @see http://www.ietf.org/rfc/rfc2822.txt
30
31
  def true(argvs)
31
- return true if argvs['reason'] == 'hasmoved'
32
+ return true if argvs['reason'] == Sisimai::Eb::ReMOVE
32
33
  return false if Sisimai::SMTP::Command::BeforeRCPT.include?(argvs['command'])
33
34
  return match(argvs['diagnosticcode'].downcase)
34
35
  end
@@ -2,10 +2,11 @@ module Sisimai
2
2
  module Reason
3
3
  # This is the error that a domain part ( Right hand side of @ sign ) of a recipient's email
4
4
  # address does not exist. In many case, the domain part is misspelled, or the domain name has
5
- # been expired. Sisimai will set "hostunknown" to the reason of email bounce if the value of
5
+ # been expired. Sisimai will set "HostUnknown" to the reason of email bounce if the value of
6
6
  # Status: field in a bounce mail is "5.1.2".
7
7
  module HostUnknown
8
8
  class << self
9
+ require 'sisimai/eb'
9
10
  Index = [
10
11
  "all host address lookups failed", # Exim/transports/smtp.c:3524
11
12
  "couldn't find any host ", # qmail-remote.c:78
@@ -32,7 +33,7 @@ module Sisimai
32
33
  ["unrout", "able ", "address"],
33
34
  ].freeze
34
35
 
35
- def text; return 'hostunknown'; end
36
+ def text; return Sisimai::Eb::ReHOST; end
36
37
  def description; return "Delivery failed due to a domain part of a recipient's email address does not exist"; end
37
38
 
38
39
  # Try to match that the given text and regular expressions
@@ -52,13 +53,13 @@ module Sisimai
52
53
  # false: is not unknown host.
53
54
  # @see http://www.ietf.org/rfc/rfc2822.txt
54
55
  def true(argvs)
55
- return true if argvs['reason'] == 'hostunknown'
56
+ return true if argvs['reason'] == Sisimai::Eb::ReHOST
56
57
  return false if Sisimai::SMTP::Command::BeforeRCPT.include?(argvs['command'])
57
58
 
58
59
  issuedcode = argvs['diagnosticcode'].downcase || ''
59
60
  statuscode = argvs['deliverystatus'] || ''
60
61
 
61
- if Sisimai::SMTP::Status.name(statuscode) == 'hostunknown'
62
+ if Sisimai::SMTP::Status.name(statuscode) == Sisimai::Eb::ReHOST
62
63
  # To prevent classifying DNS errors as "HostUnknown"
63
64
  require 'sisimai/reason/networkerror'
64
65
  return true if Sisimai::Reason::NetworkError.match(issuedcode) == false
@@ -1,12 +1,13 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::MailboxFull checks the bounce reason is "mailboxfull" or not. This class is
3
+ # Sisimai::Reason::MailboxFull checks the bounce reason is "MailboxFull" or not. This class is
4
4
  # called only Sisimai::Reason class.
5
5
  #
6
- # This is the error that a recipient's mailbox is full. Sisimai will set "mailboxfull" to the
6
+ # This is the error that a recipient's mailbox is full. Sisimai will set "MailboxFull" to the
7
7
  # reason of email bounce if the value of Status: field in a bounce email is "4.2.2" or "5.2.2".
8
8
  module MailboxFull
9
9
  class << self
10
+ require 'sisimai/eb'
10
11
  Index = [
11
12
  "452 insufficient disk space",
12
13
  "account disabled temporarly for exceeding receiving limits",
@@ -37,7 +38,7 @@ module Sisimai
37
38
  ["quota ", "exceeded"], # Exim/transports/appendfile.c:3050
38
39
  ].freeze
39
40
 
40
- def text; return 'mailboxfull'; end
41
+ def text; return Sisimai::Eb::ReFULL; end
41
42
  def description; return "Email rejected due to a recipient's mailbox is full"; end
42
43
 
43
44
  # Try to match that the given text and regular expressions
@@ -57,12 +58,12 @@ module Sisimai
57
58
  # @see http://www.ietf.org/rfc/rfc2822.txt
58
59
  def true(argvs)
59
60
  return false if argvs['deliverystatus'].empty?
60
- return true if argvs['reason'] == 'mailboxfull'
61
+ return true if argvs['reason'] == Sisimai::Eb::ReFULL
61
62
 
62
- # Delivery status code points "mailboxfull".
63
+ # Delivery status code points "MailboxFull".
63
64
  # Status: 4.2.2
64
65
  # Diagnostic-Code: SMTP; 450 4.2.2 <***@example.jp>... Mailbox Full
65
- return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == 'mailboxfull'
66
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == Sisimai::Eb::ReFULL
66
67
  return match(argvs['diagnosticcode'].downcase)
67
68
  end
68
69
 
@@ -1,6 +1,6 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::MailerError checks the bounce reason is "mailererror" or not. This class is
3
+ # Sisimai::Reason::MailerError checks the bounce reason is "MailerError" or not. This class is
4
4
  # called only Sisimai::Reason class.
5
5
  #
6
6
  # This is the error that a mailer program has not exited successfully or exited unexpectedly on
@@ -10,6 +10,7 @@ module Sisimai
10
10
  # Diagnostic-Code: X-Unix; 255
11
11
  module MailerError
12
12
  class << self
13
+ require 'sisimai/eb'
13
14
  Index = [
14
15
  ' || exit ',
15
16
  'procmail: ',
@@ -23,7 +24,7 @@ module Sisimai
23
24
  'x-unix; ',
24
25
  ].freeze
25
26
 
26
- def text; return 'mailererror'; end
27
+ def text; return Sisimai::Eb::ReUNIX; end
27
28
  def description; return 'Email returned due to a mailer program has not exited successfully'; end
28
29
 
29
30
  # Try to match that the given text and regular expressions
@@ -1,6 +1,6 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::NetworkError checks the bounce reason is "networkerror" or not. This class is
3
+ # Sisimai::Reason::NetworkError checks the bounce reason is "NetworkError" or not. This class is
4
4
  # called only Sisimai::Reason class. This is the error that SMTP connection failed due to DNS
5
5
  # look up failure or other network problems.
6
6
  #
@@ -10,6 +10,7 @@ module Sisimai
10
10
  # kijitora@neko.example.jp: Network error on destination MXs
11
11
  module NetworkError
12
12
  class << self
13
+ require 'sisimai/eb'
13
14
  Index = [
14
15
  "address family mismatch on destination mxs", # OpenSMTPD/smtpd/mta.c
15
16
  "all routes to destination blocked", # OpenSMTPD/smtpd/mta.c
@@ -40,7 +41,7 @@ module Sisimai
40
41
  ["no ", "route to"],
41
42
  ].freeze
42
43
 
43
- def text; return 'networkerror'; end
44
+ def text; return Sisimai::Eb::ReINET; end
44
45
  def description; return 'SMTP connection failed due to DNS look up failure or other network problems'; end
45
46
 
46
47
  # Try to match that the given text and regular expressions
@@ -1,6 +1,6 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::NoRelaying checks the bounce reason is "norelaying" or not. This class is
3
+ # Sisimai::Reason::NoRelaying checks the bounce reason is "NoRelaying" or not. This class is
4
4
  # called only Sisimai::Reason class.
5
5
  #
6
6
  # ... while talking to mailin-01.mx.example.com.:
@@ -9,6 +9,7 @@ module Sisimai
9
9
  # 554 5.0.0 Service unavailable
10
10
  module NoRelaying
11
11
  class << self
12
+ require 'sisimai/eb'
12
13
  Index = [
13
14
  "as a relay",
14
15
  "domain isn't in my list of allowed rcpthost",
@@ -32,7 +33,7 @@ module Sisimai
32
33
  ["n", "t ", "to relay"],
33
34
  ].freeze
34
35
 
35
- def text; return 'norelaying'; end
36
+ def text; return Sisimai::Eb::RePASS; end
36
37
  def description; return 'Email rejected with error message "Relaying Denied"'; end
37
38
 
38
39
  # Try to match that the given text and regular expressions
@@ -53,7 +54,7 @@ module Sisimai
53
54
  def true(argvs)
54
55
  r = argvs['reason'] || ''
55
56
  return false if Sisimai::SMTP::Command::BeforeRCPT.include?(argvs['command'])
56
- return false if r.start_with?('securityerror', 'systemerror', 'undefined')
57
+ return false if r.start_with?(Sisimai::Eb::ReSAFE, Sisimai::Eb::RePROC, Sisimai::Eb::Re___0)
57
58
  return match(argvs['diagnosticcode'].downcase)
58
59
  end
59
60
 
@@ -1,13 +1,14 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::NotAccept checks the bounce reason is "notaccept" or not. This class is
3
+ # Sisimai::Reason::NotAccept checks the bounce reason is "NotAccept" or not. This class is
4
4
  # called only Sisimai::Reason class.
5
5
  #
6
6
  # This is the error that a destination mail server does ( or can ) not accept any email. In
7
- # many case, the server is high load or under the maintenance. Sisimai will set "notaccept" to
7
+ # many case, the server is high load or under the maintenance. Sisimai will set "NotAccept" to
8
8
  # the reason of email bounce if the value of Status: field in a bounce email is "5.3.2" or the
9
9
  # value of SMTP reply code is 556.
10
10
  module NotAccept
11
+ require 'sisimai/eb'
11
12
  class << self
12
13
  # Destination mail server does not accept any message
13
14
  Index = [
@@ -24,7 +25,7 @@ module Sisimai
24
25
  ["no mx ", "found for "], # OpenSMTPD/smtp/mta.c
25
26
  ].freeze
26
27
 
27
- def text; return 'notaccept'; end
28
+ def text; return Sisimai::Eb::Re00MX; end
28
29
  def description; return 'Delivery failed due to a destination mail server does not accept any email'; end
29
30
 
30
31
  # Try to match that the given text and regular expressions
@@ -43,7 +44,7 @@ module Sisimai
43
44
  # false: Accept
44
45
  # @see http://www.ietf.org/rfc/rfc2822.txt
45
46
  def true(argvs)
46
- return true if argvs['reason'] == 'notaccept'
47
+ return true if argvs['reason'] == Sisimai::Eb::Re00MX
47
48
  return true if [521, 556].index(argvs['replycode'].to_i) # SMTP Reply Code is 554 or 556
48
49
  return false if Sisimai::SMTP::Command::BeforeRCPT.include?(argvs['command'])
49
50
  return match(argvs['diagnosticcode'].downcase)
@@ -1,12 +1,13 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::NotCompliantRFC checks the bounce reason is "notcompliantrfc" or not. This
3
+ # Sisimai::Reason::NotCompliantRFC checks the bounce reason is "NotCompliantRFC" or not. This
4
4
  # class is called only from Sisimai::Reason class.
5
5
  #
6
6
  # This is the error that an email is not compliant RFC 5322 or other email related RFCs. For
7
7
  # example, there are multiple "Subject" headers in the email.
8
8
  module NotCompliantRFC
9
9
  class << self
10
+ require 'sisimai/eb'
10
11
  Index = [
11
12
  "duplicate header",
12
13
  "duplicated message-id",
@@ -16,7 +17,7 @@ module Sisimai
16
17
  "https://support.google.com/mail/?p=rfcmessagenoncompliant",
17
18
  ].freeze
18
19
 
19
- def text; return 'notcompliantrfc'; end
20
+ def text; return Sisimai::Eb::ReNRFC; end
20
21
  def description; return 'Email rejected due to non-compliance with RFC'; end
21
22
 
22
23
  # Try to match that the given text and regular expressions
@@ -34,7 +35,7 @@ module Sisimai
34
35
  # false: Is not RFC compliant
35
36
  # @see http://www.ietf.org/rfc/rfc5322.txt
36
37
  def true(argvs)
37
- return true if argvs['reason'] == 'notcompliantrfc'
38
+ return true if argvs['reason'] == Sisimai::Eb::ReNRFC
38
39
  return match(argvs['diagnosticcode'].downcase)
39
40
  end
40
41
 
@@ -1,11 +1,12 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::OnHold checks the bounce reason is "onhold" or not. This class is called only
4
- # Sisimai::Reason class. Sisimai will set "onhold" to the reason of email bounce if there is no
3
+ # Sisimai::Reason::OnHold checks the bounce reason is "OnHold" or not. This class is called only
4
+ # Sisimai::Reason class. Sisimai will set "OnHold" to the reason of email bounce if there is no
5
5
  # (or less) detailed information about email bounce for judging the reason.
6
6
  module OnHold
7
7
  class << self
8
- def text; return 'onhold'; end
8
+ require 'sisimai/eb'
9
+ def text; return Sisimai::Eb::Re___1; end
9
10
  def description; return 'Sisimai could not decided the reason due to there is no (or less) detailed information for judging the reason'; end
10
11
 
11
12
  # Try to match that the given text and regular expressions
@@ -15,13 +16,13 @@ module Sisimai
15
16
 
16
17
  # On hold, Could not decide the bounce reason...
17
18
  # @param [Sisimai::Fact] argvs Object to be detected the reason
18
- # @return [Boolean] true: Status code is "onhold"
19
- # false: is not "onhold"
19
+ # @return [Boolean] true: Status code is "OnHold"
20
+ # false: is not "OnHold"
20
21
  # @see http://www.ietf.org/rfc/rfc2822.txt
21
22
  def true(argvs)
22
23
  return false if argvs['deliverystatus'].empty?
23
- return true if argvs['reason'] == 'onhold'
24
- return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == 'onhold'
24
+ return true if argvs['reason'] == Sisimai::Eb::Re___1
25
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == Sisimai::Eb::Re___1
25
26
  return false
26
27
  end
27
28
  end
@@ -1,11 +1,11 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::PolicyViolation checks the bounce reason is "policyviolation" or not. This class
3
+ # Sisimai::Reason::PolicyViolation checks the bounce reason is "PolicyViolation" or not. This class
4
4
  # is called only Sisimai::Reason class.
5
5
  #
6
6
  # This is the error that a policy violation was detected on a destination mail host. When a header
7
7
  # content or a format of the original message violates security policies, or multiple addresses
8
- # exist in the From: header, Sisimai will set "policyviolation".
8
+ # exist in the From: header, Sisimai will set "PolicyViolation".
9
9
  #
10
10
  # Status: 5.7.0
11
11
  # Remote-MTA: DNS; gmail-smtp-in.l.google.com
@@ -14,6 +14,7 @@ module Sisimai
14
14
  #
15
15
  module PolicyViolation
16
16
  class << self
17
+ require 'sisimai/eb'
17
18
  Index = [
18
19
  "because the recipient is not accepting mail with ", # AOL Phoenix
19
20
  "closed mailing list",
@@ -31,7 +32,7 @@ module Sisimai
31
32
  "you're using a mass mailer",
32
33
  ].freeze
33
34
 
34
- def text; return 'policyviolation'; end
35
+ def text; return Sisimai::Eb::ReWONT; end
35
36
  def description; return 'Email rejected due to policy violation on a destination host'; end
36
37
 
37
38
  # Try to match that the given text and regular expressions
@@ -44,15 +45,15 @@ module Sisimai
44
45
  return false
45
46
  end
46
47
 
47
- # The bounce reason is "policyviolation" or not
48
+ # The bounce reason is "PolicyViolation" or not
48
49
  # @param [Sisimai::Fact] argvs Object to be detected the reason
49
50
  # @return [Boolean] true: is policy violation
50
51
  # false: is not policy violation
51
52
  # @since 4.22.0
52
53
  # @see http://www.ietf.org/rfc/rfc2822.txt
53
54
  def true(argvs)
54
- return true if argvs['reason'] == 'policyviolation'
55
- return false if argvs['command'] != '' && argvs['command'] != 'DATA'
55
+ return true if argvs['reason'] == Sisimai::Eb::ReWONT
56
+ return false if argvs['command'] != '' && argvs['command'] != Sisimai::Eb::CeDATA
56
57
  return match(argvs['diagnosticcode'].downcase)
57
58
  end
58
59