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::RateLimited checks the bounce reason is "ratelimited" or not. This class is
3
+ # Sisimai::Reason::RateLimited checks the bounce reason is "RateLimited" or not. This class is
4
4
  # called only Sisimai::Reason class.
5
5
  #
6
6
  # This is the error that SMTP connection was rejected temporarily due to too many recipients or
@@ -10,6 +10,7 @@ module Sisimai
10
10
  # 452 4.3.2 Connection rate limit exceeded. (in reply to MAIL FROM command)
11
11
  module RateLimited
12
12
  class << self
13
+ require 'sisimai/eb'
13
14
  Index = [
14
15
  "has exceeded the max emails per hour ",
15
16
  "please try again slower",
@@ -29,7 +30,7 @@ module Sisimai
29
30
  ["too many con", "s"],
30
31
  ].freeze
31
32
 
32
- def text; return 'ratelimited'; end
33
+ def text; return Sisimai::Eb::ReRATE; end
33
34
  def description; return 'SMTP connection rejected temporarily due to too many concurrency connections to the remote host'; end
34
35
 
35
36
  # Try to match that the given text and regular expressions
@@ -48,8 +49,8 @@ module Sisimai
48
49
  # false: is not rate limited
49
50
  # @see http://www.ietf.org/rfc/rfc2822.txt
50
51
  def true(argvs)
51
- return true if argvs['reason'] == 'ratelimited'
52
- return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == 'ratelimited'
52
+ return true if argvs['reason'] == Sisimai::Eb::ReRATE
53
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == Sisimai::Eb::ReRATE
53
54
  return match(argvs['diagnosticcode'].downcase)
54
55
  end
55
56
 
@@ -1,10 +1,10 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::Rejected checks the bounce reason is "rejected" or not. This class is called
3
+ # Sisimai::Reason::Rejected checks the bounce reason is "Rejected" or not. This class is called
4
4
  # only Sisimai::Reason class.
5
5
  #
6
6
  # This is the error that a connection to destination server was rejected by a sender's email
7
- # address (envelope from). Sisimai set "rejected" to the reason of email bounce if the value of
7
+ # address (envelope from). Sisimai set "Rejected" to the reason of email bounce if the value of
8
8
  # Status: field in a bounce email is "5.1.8" or the connection has been rejected due to the
9
9
  # argument of SMTP MAIL command.
10
10
  #
@@ -13,6 +13,7 @@ module Sisimai
13
13
  # Remote host said: 550 5.7.1 <root@nijo.example.jp>... Access denied
14
14
  module Rejected
15
15
  class << self
16
+ require 'sisimai/eb'
16
17
  IsNot = [
17
18
  "5.1.0 address rejected",
18
19
  "ip address ",
@@ -69,7 +70,7 @@ module Sisimai
69
70
  ["sender is", " list"],
70
71
  ].freeze
71
72
 
72
- def text; return 'rejected'; end
73
+ def text; return Sisimai::Eb::ReFROM; end
73
74
  def description; return "Email rejected due to a sender's email address (envelope from)"; end
74
75
 
75
76
  # Try to match that the given text and regular expressions
@@ -89,28 +90,31 @@ module Sisimai
89
90
  # false: is not rejected by the sender
90
91
  # @see http://www.ietf.org/rfc/rfc2822.txt
91
92
  def true(argvs)
92
- return true if argvs['reason'] == 'rejected'
93
+ return true if argvs['reason'] == Sisimai::Eb::ReFROM
93
94
  tempreason = Sisimai::SMTP::Status.name(argvs['deliverystatus'])
94
- return true if tempreason == 'rejected' # Delivery status code points "rejected".
95
+ return true if tempreason == Sisimai::Eb::ReFROM # Delivery status code points "Rejected".
95
96
 
96
97
  # Check the value of Diagnosic-Code: header with patterns
97
98
  issuedcode = argvs['diagnosticcode'].downcase
98
99
  thecommand = argvs['command'] || ''
99
- if thecommand == 'MAIL'
100
+ if thecommand == Sisimai::Eb::CeMAIL
100
101
  # The session was rejected at 'MAIL FROM' command
101
102
  return true if match(issuedcode)
102
103
 
103
- elsif thecommand == 'DATA'
104
+ elsif thecommand == Sisimai::Eb::CeDATA
104
105
  # The session was rejected at 'DATA' command
105
- if tempreason != 'userunknown'
106
- # Except "userunknown"
106
+ if tempreason != Sisimai::Eb::ReUSER
107
+ # Except "UserUnknown"
107
108
  return true if match(issuedcode)
108
109
  end
109
- elsif %w[onhold undefined securityerror systemerror].include?(tempreason) || tempreason == ""
110
- # Try to match with message patterns when the temporary reason is "onhold", "undefined",
111
- # "securityerror", or "systemerror"
112
- return true if match(issuedcode)
113
- end
110
+ else
111
+ tryto = [Sisimai::Eb::Re___1, Sisimai::Eb::Re___0, Sisimai::Eb::ReSAFE, Sisimai::Eb::RePROC]
112
+ if tryto.include?(tempreason) || tempreason == ""
113
+ # Try to match with message patterns when the temporary reason is "OnHold", "Undefined",
114
+ # "SecurityError", or "SystemError"
115
+ return true if match(issuedcode)
116
+ end
117
+ end
114
118
  return false
115
119
  end
116
120
 
@@ -1,11 +1,12 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::RequirePTR checks the bounce reason is "requireptr" or not. This class is
3
+ # Sisimai::Reason::RequirePTR checks the bounce reason is "RequirePTR" or not. This class is
4
4
  # called only from Sisimai::Reason class. This is the error that SMTP connection was rejected
5
5
  # due to missing PTR record or having invalid PTR record at the source IP address used for the
6
6
  # SMTP connection.
7
7
  module RequirePTR
8
8
  class << self
9
+ require 'sisimai/eb'
9
10
  Index = [
10
11
  "cannot find your hostname",
11
12
  "cannot resolve your address.",
@@ -25,7 +26,7 @@ module Sisimai
25
26
  ["service permits ", " unverifyable sending ips"],
26
27
  ].freeze
27
28
 
28
- def text; return 'requireptr'; end
29
+ def text; return Sisimai::Eb::ReQPTR; end
29
30
  def description; return 'Email rejected due to missing PTR record or having invalid PTR record'; end
30
31
 
31
32
  # Try to match that the given text and regular expressions
@@ -44,8 +45,8 @@ module Sisimai
44
45
  # false: is not blocked due to missing PTR record
45
46
  # @see http://www.ietf.org/rfc/rfc5322.txt
46
47
  def true(argvs)
47
- return true if argvs['reason'] == 'requireptr'
48
- return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == 'requireptr'
48
+ return true if argvs['reason'] == Sisimai::Eb::ReQPTR
49
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == Sisimai::Eb::ReQPTR
49
50
  return match(argvs['diagnosticcode'].downcase)
50
51
  end
51
52
 
@@ -1,12 +1,12 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::SecurityError checks the bounce reason is "securityerror" or not. This class
3
+ # Sisimai::Reason::SecurityError checks the bounce reason is "SecurityError" or not. This class
4
4
  # is called only Sisimai::Reason class.
5
5
  #
6
6
  # This is the error that a security violation was detected on a destination mail server. Depends
7
7
  # on the security policy on the server, a sender's email address is camouflaged address.
8
8
  #
9
- # Sisimai will set "securityerror" to the reason of email bounce if the value of Status: field
9
+ # Sisimai will set "SecurityError" to the reason of email bounce if the value of Status: field
10
10
  # in a bounce email is "5.7.*".
11
11
  #
12
12
  # Action: failed
@@ -17,6 +17,7 @@ module Sisimai
17
17
  #
18
18
  module SecurityError
19
19
  class << self
20
+ require 'sisimai/eb'
20
21
  Index = [
21
22
  "account not subscribed to ses",
22
23
  "authentication credentials invalid",
@@ -36,7 +37,7 @@ module Sisimai
36
37
  ["user ", " is not authorized to perform ses:sendrawemail on resource"],
37
38
  ].freeze
38
39
 
39
- def text; return 'securityerror'; end
40
+ def text; return Sisimai::Eb::ReSAFE; end
40
41
  def description; return 'Email rejected due to security violation was detected on a destination host'; end
41
42
 
42
43
  # 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::SpamDetected checks the bounce reason is "spamdetected" due to Spam content
3
+ # Sisimai::Reason::SpamDetected checks the bounce reason is "SpamDetected" due to Spam content
4
4
  # in the message or not. This class is called only Sisimai::Reason class. This is the error that
5
5
  # the message you sent was rejected by "spam filter" which is running on the remote host.
6
6
  #
@@ -10,6 +10,7 @@ module Sisimai
10
10
  # Last-Attempt-Date: Thu, 9 Apr 2008 23:34:45 +0900 (JST)
11
11
  module SpamDetected
12
12
  class << self
13
+ require 'sisimai/eb'
13
14
  Index = [
14
15
  "blacklisted url in message",
15
16
  "block for spam",
@@ -65,7 +66,7 @@ module Sisimai
65
66
  ["spam ", "score"],
66
67
  ].freeze
67
68
 
68
- def text; return 'spamdetected'; end
69
+ def text; return Sisimai::Eb::ReSPAM; end
69
70
  def description; return 'Email rejected by spam filter running on the remote host'; end
70
71
 
71
72
  # Try to match that the given text and regular expressions
@@ -85,10 +86,10 @@ module Sisimai
85
86
  # @see http://www.ietf.org/rfc/rfc2822.txt
86
87
  def true(argvs)
87
88
  return false if argvs['deliverystatus'].empty?
88
- return true if argvs['reason'] == 'spamdetected'
89
- return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == 'spamdetected'
89
+ return true if argvs['reason'] == Sisimai::Eb::ReSPAM
90
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == Sisimai::Eb::ReSPAM
90
91
 
91
- # The value of "reason" isn't "spamdetected" when the value of "command" is an SMTP command
92
+ # The value of "reason" isn't "SpamDetected" when the value of "command" is an SMTP command
92
93
  # to be sent before the SMTP DATA command because all the MTAs read the headers and the
93
94
  # entire message body after the DATA command.
94
95
  return false if Sisimai::SMTP::Command::ExceptDATA.include?(argvs['command'])
@@ -1,13 +1,14 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::Suppressed checks the bounce reason is "suppressed" or not. This class is called
3
+ # Sisimai::Reason::Suppressed checks the bounce reason is "Suppressed" or not. This class is called
4
4
  # only Sisimai::Reason class.
5
5
  #
6
6
  # This is the error that the recipient adddress is listed in the suppression list of the relay
7
7
  # server, and was not delivered.
8
8
  module Suppressed
9
9
  class << self
10
- def text; return 'suppressed'; end
10
+ require 'sisimai/eb'
11
+ def text; return Sisimai::Eb::ReSTOP; end
11
12
  def description; return "Email was not delivered due to being listed in the suppression list of MTA"; end
12
13
 
13
14
  # Try to match that the given text and regular expressions
@@ -21,7 +22,7 @@ module Sisimai
21
22
  # false: is not listed in the suppression list
22
23
  # @see http://www.ietf.org/rfc/rfc2822.txt
23
24
  def true(argvs)
24
- return true if argvs['reason'] == 'suppressed'
25
+ return true if argvs['reason'] == Sisimai::Eb::ReSTOP
25
26
  return match(argvs['diagnosticcode'].downcase)
26
27
  end
27
28
 
@@ -1,10 +1,11 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::Suspend checks the bounce reason is "suspend" or not. This class is called
3
+ # Sisimai::Reason::Suspend checks the bounce reason is "Suspend" or not. This class is called
4
4
  # only Sisimai::Reason class. This is the error that a recipient account is being suspended
5
5
  # due to unpaid or other reasons.
6
6
  module Suspend
7
7
  class << self
8
+ require 'sisimai/eb'
8
9
  Index = [
9
10
  " currently suspended",
10
11
  " temporary locked",
@@ -37,7 +38,7 @@ module Sisimai
37
38
  ["not ", "active"],
38
39
  ].freeze
39
40
 
40
- def text; return 'suspend'; end
41
+ def text; return Sisimai::Eb::ReQUIT; end
41
42
  def description; return 'Email rejected due to a recipient account is being suspended'; end
42
43
 
43
44
  # Try to match that the given text and regular expressions
@@ -56,7 +57,7 @@ module Sisimai
56
57
  # false: is not suspended
57
58
  # @see http://www.ietf.org/rfc/rfc2822.txt
58
59
  def true(argvs)
59
- return true if argvs['reason'] == 'suspend' || argvs['replycode'].to_i == 525
60
+ return true if argvs['reason'] == Sisimai::Eb::ReQUIT || argvs['replycode'].to_i == 525
60
61
  return match(argvs['diagnosticcode'].downcase)
61
62
  end
62
63
 
@@ -1,10 +1,10 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::SyntaxError checks the bounce reason is "syntaxerror" or not. This class is
3
+ # Sisimai::Reason::SyntaxError checks the bounce reason is "SyntaxError" 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 could not recognize SMTP command which is
7
- # sent from a sender's MTA. Sisimai will set "syntaxerror" to the reason if the value of
7
+ # sent from a sender's MTA. Sisimai will set "SyntaxError" to the reason if the value of
8
8
  # "replycode" begins with "50" such as 502, or 503.
9
9
  # Action: failed
10
10
  # Status: 5.5.0
@@ -12,7 +12,8 @@ module Sisimai
12
12
  #
13
13
  module SyntaxError
14
14
  class << self
15
- def text; return 'syntaxerror'; end
15
+ require 'sisimai/eb'
16
+ def text; return Sisimai::Eb::ReCOMM; end
16
17
  def description; return 'Email rejected due to syntax error at sent commands in SMTP session'; end
17
18
  def match(*); return false; end
18
19
 
@@ -1,6 +1,6 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::SystemError checks the bounce reason is "systemerror" or not. This class is
3
+ # Sisimai::Reason::SystemError checks the bounce reason is "SystemError" or not. This class is
4
4
  # called only Sisimai::Reason class. This is the error that an email has bounced due to system
5
5
  # error on the remote host such as LDAP connection failure or other internal system error.
6
6
  #
@@ -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/eb'
12
13
  Index = [
13
14
  "aliasing/forwarding loop broken",
14
15
  "automatic homedir creator crashed", # qmail-ldap-1.03-20040101.patch:19817 - 19866
@@ -52,7 +53,7 @@ module Sisimai
52
53
  ["unable to connect ", "daemon"],
53
54
  ].freeze
54
55
 
55
- def text; return 'systemerror'; end
56
+ def text; return Sisimai::Eb::RePROC; end
56
57
  def description; return 'Email returned due to system error on the remote host'; end
57
58
 
58
59
  # Try to match that the given text and regular expressions
@@ -1,19 +1,20 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::SystemFull checks the bounce reason is "systemfull" or not. This class is called
3
+ # Sisimai::Reason::SystemFull checks the bounce reason is "SystemFull" or not. This class is called
4
4
  # only Sisimai::Reason class.
5
5
  #
6
6
  # This is the error that a destination mail server's disk (or spool) is full. Sisimai will set
7
- # systemfull to the reason of email bounce if the value of Status: field in a bounce email is
7
+ # "SystemFull" to the reason of email bounce if the value of Status: field in a bounce email is
8
8
  # "4.3.1" or "5.3.1".
9
9
  module SystemFull
10
10
  class << self
11
+ require 'sisimai/eb'
11
12
  Index = [
12
13
  'exceeded storage allocation', # MS Exchange
13
14
  'mail system full',
14
15
  ].freeze
15
16
 
16
- def text; return 'systemfull'; end
17
+ def text; return Sisimai::Eb::ReDISK; end
17
18
  def description; return "Email rejected due to a destination mail server's disk is full"; end
18
19
 
19
20
  # Try to match that the given text and regular expressions
@@ -3,8 +3,9 @@ module Sisimai
3
3
  # Sisimai::Reason::Undefined is for only returning text and description. This class is called only
4
4
  # from Sisimai.reason method.
5
5
  module Undefined
6
+ require 'sisimai/eb'
6
7
  class << self
7
- def text; return 'undefined'; end
8
+ def text; return Sisimai::Eb::Re___0; end
8
9
  def description; return 'Sisimai could not detect an error reason'; end
9
10
  def match; return false; end
10
11
  def true(*); return false; end
@@ -1,11 +1,11 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::UserUnknown checks the bounce reason is "userunknown" or not. This class is
3
+ # Sisimai::Reason::UserUnknown checks the bounce reason is "UserUnknown" or not. This class is
4
4
  # called only Sisimai::Reason class.
5
5
  #
6
6
  # This is the error that a local part (Left hand side of @ sign) of a recipient's email address
7
7
  # does not exist. In many case, a user has changed internet service provider, or has quit company,
8
- # or the local part is misspelled. Sisimai will set "userunknown" to the reason of email bounce
8
+ # or the local part is misspelled. Sisimai will set "UserUnknown" to the reason of email bounce
9
9
  # if the value of Status: field in a bounce email is "5.1.1", or connection was refused at SMTP
10
10
  # RCPT command, or the contents of Diagnostic-Code: field represents that it is unknown user.
11
11
  #
@@ -14,7 +14,11 @@ module Sisimai
14
14
  # RCPT TO command)
15
15
  module UserUnknown
16
16
  class << self
17
- PreMatches = %w[NoRelaying Blocked MailboxFull HasMoved Rejected NotAccept]
17
+ require 'sisimai/eb'
18
+ PreMatches = [
19
+ Sisimai::Eb::RePASS, Sisimai::Eb::ReBLOC, Sisimai::Eb::ReFULL,
20
+ Sisimai::Eb::ReMOVE, Sisimai::Eb::ReFROM, Sisimai::Eb::Re00MX,
21
+ ]
18
22
  ModulePath = {
19
23
  'Sisimai::Reason::NoRelaying' => 'sisimai/reason/norelaying',
20
24
  'Sisimai::Reason::Blocked' => 'sisimai/reason/blocked',
@@ -109,7 +113,7 @@ module Sisimai
109
113
  ["user <", "> unknown"],
110
114
  ].freeze
111
115
 
112
- def text; return 'userunknown'; end
116
+ def text; return Sisimai::Eb::ReUSER; end
113
117
  def description; return "Email rejected due to a local part of a recipient's email address does not exist"; end
114
118
 
115
119
  # Try to match that the given text and regular expressions
@@ -122,20 +126,20 @@ module Sisimai
122
126
  return false
123
127
  end
124
128
 
125
- # Whether the address is "userunknown" or not
129
+ # Whether the address is "UserUnknown" or not
126
130
  # @param [Sisimai::Fact] argvs Object to be detected the reason
127
131
  # @return [Boolean] true: is unknown user
128
132
  # false: is not unknown user.
129
133
  # @see http://www.ietf.org/rfc/rfc2822.txt
130
134
  def true(argvs)
131
- return true if argvs['reason'] == 'userunknown'
135
+ return true if argvs['reason'] == Sisimai::Eb::ReUSER
132
136
  return false if Sisimai::SMTP::Command::BeforeRCPT.include?(argvs['command'])
133
137
 
134
138
  tempreason = Sisimai::SMTP::Status.name(argvs['deliverystatus'])
135
- return false if tempreason == 'suspend'
139
+ return false if tempreason == Sisimai::Eb::ReQUIT
136
140
 
137
141
  issuedcode = argvs['diagnosticcode'].downcase
138
- if tempreason == 'userunknown'
142
+ if tempreason == Sisimai::Eb::ReUSER
139
143
  # *.1.1 = 'Bad destination mailbox address'
140
144
  # Status: 5.1.1
141
145
  # Diagnostic-Code: SMTP; 550 5.1.1 <***@example.jp>:
@@ -160,7 +164,7 @@ module Sisimai
160
164
  end
161
165
  return true if matchother == false # Did not match with other message patterns
162
166
 
163
- elsif argvs['command'] == 'RCPT'
167
+ elsif argvs['command'] == Sisimai::Eb::CeRCPT
164
168
  # When the SMTP command is not "RCPT", the session rejected by other
165
169
  # reason, maybe.
166
170
  return true if match(issuedcode)
@@ -4,6 +4,7 @@ module Sisimai
4
4
  # from Sisimai.reason method.
5
5
  module Vacation
6
6
  class << self
7
+ require 'sisimai/eb'
7
8
  Index = [
8
9
  'i am away on vacation',
9
10
  'i am away until',
@@ -11,7 +12,7 @@ module Sisimai
11
12
  'i will be traveling for work on',
12
13
  ].freeze
13
14
 
14
- def text; return 'vacation'; end
15
+ def text; return Sisimai::Eb::ReAWAY; end
15
16
  def description; return 'Email replied automatically due to a recipient is out of office'; end
16
17
 
17
18
  # Try to match that the given text and regular expressions
@@ -1,10 +1,10 @@
1
1
  module Sisimai
2
2
  module Reason
3
- # Sisimai::Reason::VirusDetected checks the bounce reason is "virusdetected" or not. This class
3
+ # Sisimai::Reason::VirusDetected checks the bounce reason is "VirusDetected" or not. This class
4
4
  # is called only Sisimai::Reason class.
5
5
  #
6
6
  # This is an error that any virus or trojan horse detected in the message by a virus scanner program
7
- # at a destination mail server. This reason has been divided from "securityerror" at Sisimai 4.22.0.
7
+ # at a destination mail server. This reason has been divided from "SecurityError" at Sisimai 4.22.0.
8
8
  #
9
9
  # Your message was infected with a virus. You should download a virus
10
10
  # scanner and check your computer for viruses.
@@ -14,13 +14,14 @@ module Sisimai
14
14
  #
15
15
  module VirusDetected
16
16
  class << self
17
+ require 'sisimai/eb'
17
18
  Index = ["it has a potentially executable attachment"].freeze
18
19
  Pairs = [
19
20
  ["message was ", "ected", " virus"],
20
21
  ["virus", " detected"],
21
22
  ].freeze
22
23
 
23
- def text; return 'virusdetected'; end
24
+ def text; return Sisimai::Eb::ReEXEC; end
24
25
  def description; return 'Email rejected due to a virus scanner on a destination host'; end
25
26
 
26
27
  # Try to match that the given text and regular expressions
@@ -34,7 +35,7 @@ module Sisimai
34
35
  return false
35
36
  end
36
37
 
37
- # The bounce reason is "virusdetected" or not
38
+ # The bounce reason is "VirusDetected" or not
38
39
  # @param [Sisimai::Fact] argvs Object to be detected the reason
39
40
  # @return [Boolean] true: virus detected
40
41
  # false: virus was not detected
@@ -44,7 +45,7 @@ module Sisimai
44
45
  # The value of "reason" isn't "visusdetected" when the value of "command" is an SMTP command
45
46
  # to be sent before the SMTP DATA command because all the MTAs read the headers and the
46
47
  # entire message body after the DATA command.
47
- return true if argvs['reason'] == 'virusdetected'
48
+ return true if argvs['reason'] == Sisimai::Eb::ReEXEC
48
49
  return false if Sisimai::SMTP::Command::ExceptDATA.include?(argvs['command'])
49
50
  return match(argvs['diagnosticcode'].downcase)
50
51
  end