sisimai 5.7.0 → 5.7.1

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 (98) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.md +15 -0
  3. data/README-JA.md +8 -8
  4. data/README.md +8 -8
  5. data/lib/sisimai/arf.rb +2 -1
  6. data/lib/sisimai/eb.rb +116 -0
  7. data/lib/sisimai/fact.rb +24 -17
  8. data/lib/sisimai/lda.rb +20 -18
  9. data/lib/sisimai/lhost/amazonses.rb +11 -10
  10. data/lib/sisimai/lhost/courier.rb +4 -3
  11. data/lib/sisimai/lhost/domino.rb +2 -1
  12. data/lib/sisimai/lhost/einsundeins.rb +3 -2
  13. data/lib/sisimai/lhost/exchange2003.rb +8 -7
  14. data/lib/sisimai/lhost/exchange2007.rb +14 -13
  15. data/lib/sisimai/lhost/exim.rb +7 -6
  16. data/lib/sisimai/lhost/ezweb.rb +4 -3
  17. data/lib/sisimai/lhost/fml.rb +4 -3
  18. data/lib/sisimai/lhost/gmail.rb +10 -9
  19. data/lib/sisimai/lhost/googlegroups.rb +3 -2
  20. data/lib/sisimai/lhost/googleworkspace.rb +2 -1
  21. data/lib/sisimai/lhost/imailserver.rb +3 -2
  22. data/lib/sisimai/lhost/kddi.rb +4 -3
  23. data/lib/sisimai/lhost/notes.rb +2 -1
  24. data/lib/sisimai/lhost/postfix.rb +7 -6
  25. data/lib/sisimai/lhost/qmail.rb +10 -9
  26. data/lib/sisimai/lhost/sendmail.rb +4 -3
  27. data/lib/sisimai/lhost/trendmicro.rb +2 -1
  28. data/lib/sisimai/lhost/v5sendmail.rb +2 -1
  29. data/lib/sisimai/lhost/verizon.rb +3 -2
  30. data/lib/sisimai/reason/authfailure.rb +6 -5
  31. data/lib/sisimai/reason/badreputation.rb +5 -4
  32. data/lib/sisimai/reason/blocked.rb +6 -5
  33. data/lib/sisimai/reason/contenterror.rb +6 -5
  34. data/lib/sisimai/reason/delivered.rb +3 -2
  35. data/lib/sisimai/reason/emailtoolarge.rb +6 -5
  36. data/lib/sisimai/reason/expired.rb +3 -2
  37. data/lib/sisimai/reason/failedstarttls.rb +5 -3
  38. data/lib/sisimai/reason/feedback.rb +2 -1
  39. data/lib/sisimai/reason/filtered.rb +9 -8
  40. data/lib/sisimai/reason/hasmoved.rb +5 -4
  41. data/lib/sisimai/reason/hostunknown.rb +5 -4
  42. data/lib/sisimai/reason/mailboxfull.rb +7 -6
  43. data/lib/sisimai/reason/mailererror.rb +3 -2
  44. data/lib/sisimai/reason/networkerror.rb +3 -2
  45. data/lib/sisimai/reason/norelaying.rb +4 -3
  46. data/lib/sisimai/reason/notaccept.rb +5 -4
  47. data/lib/sisimai/reason/notcompliantrfc.rb +4 -3
  48. data/lib/sisimai/reason/onhold.rb +8 -7
  49. data/lib/sisimai/reason/policyviolation.rb +7 -6
  50. data/lib/sisimai/reason/ratelimited.rb +5 -4
  51. data/lib/sisimai/reason/rejected.rb +18 -14
  52. data/lib/sisimai/reason/requireptr.rb +5 -4
  53. data/lib/sisimai/reason/securityerror.rb +4 -3
  54. data/lib/sisimai/reason/spamdetected.rb +6 -5
  55. data/lib/sisimai/reason/suppressed.rb +4 -3
  56. data/lib/sisimai/reason/suspend.rb +4 -3
  57. data/lib/sisimai/reason/syntaxerror.rb +4 -3
  58. data/lib/sisimai/reason/systemerror.rb +3 -2
  59. data/lib/sisimai/reason/systemfull.rb +4 -3
  60. data/lib/sisimai/reason/undefined.rb +2 -1
  61. data/lib/sisimai/reason/userunknown.rb +13 -9
  62. data/lib/sisimai/reason/vacation.rb +2 -1
  63. data/lib/sisimai/reason/virusdetected.rb +6 -5
  64. data/lib/sisimai/reason.rb +45 -40
  65. data/lib/sisimai/rfc1894.rb +8 -2
  66. data/lib/sisimai/rfc2045.rb +6 -3
  67. data/lib/sisimai/rfc3464/thirdparty.rb +10 -9
  68. data/lib/sisimai/rfc3834.rb +4 -2
  69. data/lib/sisimai/rhost/aol.rb +3 -2
  70. data/lib/sisimai/rhost/apple.rb +12 -11
  71. data/lib/sisimai/rhost/cloudflare.rb +3 -2
  72. data/lib/sisimai/rhost/cox.rb +38 -37
  73. data/lib/sisimai/rhost/facebook.rb +17 -16
  74. data/lib/sisimai/rhost/franceptt.rb +39 -38
  75. data/lib/sisimai/rhost/godaddy.rb +35 -34
  76. data/lib/sisimai/rhost/google.rb +22 -21
  77. data/lib/sisimai/rhost/gsuite.rb +8 -7
  78. data/lib/sisimai/rhost/iua.rb +11 -10
  79. data/lib/sisimai/rhost/kddi.rb +3 -2
  80. data/lib/sisimai/rhost/messagelabs.rb +13 -12
  81. data/lib/sisimai/rhost/microsoft.rb +33 -32
  82. data/lib/sisimai/rhost/mimecast.rb +18 -17
  83. data/lib/sisimai/rhost/nttdocomo.rb +10 -9
  84. data/lib/sisimai/rhost/outlook.rb +3 -2
  85. data/lib/sisimai/rhost/spectrum.rb +19 -18
  86. data/lib/sisimai/rhost/tencent.rb +10 -9
  87. data/lib/sisimai/rhost/yahooinc.rb +11 -10
  88. data/lib/sisimai/rhost/zoho.rb +8 -7
  89. data/lib/sisimai/smtp/command.rb +13 -8
  90. data/lib/sisimai/smtp/failure.rb +9 -8
  91. data/lib/sisimai/smtp/reply.rb +23 -22
  92. data/lib/sisimai/smtp/status.rb +141 -140
  93. data/lib/sisimai/smtp/transcript.rb +3 -2
  94. data/lib/sisimai/version.rb +1 -1
  95. data/lib/sisimai.rb +2 -1
  96. data/set-of-emails/maildir/bsd/lhost-postfix-81.eml +130 -0
  97. data/set-of-emails/should-not-crash/go-423-deeply-nested-mime-parts.eml +20050 -0
  98. metadata +5 -2
@@ -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
 
@@ -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