sisimai 5.4.1-java → 5.6.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) 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 +56 -0
  5. data/LICENSE +1 -1
  6. data/Makefile +2 -4
  7. data/README-JA.md +29 -23
  8. data/README.md +30 -24
  9. data/lib/sisimai/address.rb +92 -44
  10. data/lib/sisimai/arf.rb +7 -8
  11. data/lib/sisimai/datetime.rb +2 -2
  12. data/lib/sisimai/fact/json.rb +1 -2
  13. data/lib/sisimai/fact/yaml.rb +1 -2
  14. data/lib/sisimai/fact.rb +76 -36
  15. data/lib/sisimai/lda.rb +2 -2
  16. data/lib/sisimai/lhost/activehunter.rb +4 -5
  17. data/lib/sisimai/lhost/amazonses.rb +4 -5
  18. data/lib/sisimai/lhost/apachejames.rb +2 -2
  19. data/lib/sisimai/lhost/biglobe.rb +6 -6
  20. data/lib/sisimai/lhost/courier.rb +7 -7
  21. data/lib/sisimai/lhost/domino.rb +6 -6
  22. data/lib/sisimai/lhost/dragonfly.rb +5 -5
  23. data/lib/sisimai/lhost/einsundeins.rb +5 -5
  24. data/lib/sisimai/lhost/exchange2003.rb +7 -7
  25. data/lib/sisimai/lhost/exchange2007.rb +5 -5
  26. data/lib/sisimai/lhost/exim.rb +13 -15
  27. data/lib/sisimai/lhost/ezweb.rb +3 -2
  28. data/lib/sisimai/lhost/fml.rb +9 -9
  29. data/lib/sisimai/lhost/gmail.rb +9 -9
  30. data/lib/sisimai/lhost/gmx.rb +3 -3
  31. data/lib/sisimai/lhost/googlegroups.rb +6 -7
  32. data/lib/sisimai/lhost/googleworkspace.rb +5 -6
  33. data/lib/sisimai/lhost/imailserver.rb +4 -4
  34. data/lib/sisimai/lhost/kddi.rb +4 -4
  35. data/lib/sisimai/lhost/mailfoundry.rb +3 -3
  36. data/lib/sisimai/lhost/{mailmarshalsmtp.rb → mailmarshal.rb} +5 -5
  37. data/lib/sisimai/lhost/messagingserver.rb +8 -8
  38. data/lib/sisimai/lhost/mfilter.rb +8 -4
  39. data/lib/sisimai/lhost/mimecast.rb +105 -0
  40. data/lib/sisimai/lhost/notes.rb +5 -5
  41. data/lib/sisimai/lhost/opensmtpd.rb +5 -5
  42. data/lib/sisimai/lhost/postfix.rb +38 -32
  43. data/lib/sisimai/lhost/qmail.rb +11 -11
  44. data/lib/sisimai/lhost/sendmail.rb +13 -13
  45. data/lib/sisimai/lhost/{interscanmss.rb → trendmicro.rb} +8 -9
  46. data/lib/sisimai/lhost/v5sendmail.rb +7 -7
  47. data/lib/sisimai/lhost/verizon.rb +3 -3
  48. data/lib/sisimai/lhost/x1.rb +7 -4
  49. data/lib/sisimai/lhost/x2.rb +40 -12
  50. data/lib/sisimai/lhost/x3.rb +3 -3
  51. data/lib/sisimai/lhost/x6.rb +2 -2
  52. data/lib/sisimai/lhost/zoho.rb +5 -5
  53. data/lib/sisimai/lhost.rb +18 -17
  54. data/lib/sisimai/mail/maildir.rb +4 -4
  55. data/lib/sisimai/mail/mbox.rb +4 -4
  56. data/lib/sisimai/mail/memory.rb +1 -1
  57. data/lib/sisimai/mail/stdin.rb +2 -2
  58. data/lib/sisimai/message.rb +36 -34
  59. data/lib/sisimai/order.rb +5 -4
  60. data/lib/sisimai/reason/authfailure.rb +10 -14
  61. data/lib/sisimai/reason/badreputation.rb +8 -8
  62. data/lib/sisimai/reason/blocked.rb +58 -83
  63. data/lib/sisimai/reason/contenterror.rb +15 -10
  64. data/lib/sisimai/reason/{mesgtoobig.rb → emailtoolarge.rb} +23 -26
  65. data/lib/sisimai/reason/expired.rb +17 -24
  66. data/lib/sisimai/reason/failedstarttls.rb +1 -1
  67. data/lib/sisimai/reason/filtered.rb +14 -18
  68. data/lib/sisimai/reason/hasmoved.rb +3 -2
  69. data/lib/sisimai/reason/hostunknown.rb +18 -21
  70. data/lib/sisimai/reason/mailboxfull.rb +28 -50
  71. data/lib/sisimai/reason/mailererror.rb +1 -1
  72. data/lib/sisimai/reason/networkerror.rb +17 -17
  73. data/lib/sisimai/reason/norelaying.rb +20 -20
  74. data/lib/sisimai/reason/notaccept.rb +7 -10
  75. data/lib/sisimai/reason/notcompliantrfc.rb +6 -10
  76. data/lib/sisimai/reason/policyviolation.rb +12 -28
  77. data/lib/sisimai/reason/ratelimited.rb +62 -0
  78. data/lib/sisimai/reason/rejected.rb +46 -58
  79. data/lib/sisimai/reason/requireptr.rb +14 -26
  80. data/lib/sisimai/reason/securityerror.rb +14 -20
  81. data/lib/sisimai/reason/spamdetected.rb +52 -102
  82. data/lib/sisimai/reason/suspend.rb +27 -24
  83. data/lib/sisimai/reason/systemerror.rb +20 -24
  84. data/lib/sisimai/reason/systemfull.rb +2 -2
  85. data/lib/sisimai/reason/userunknown.rb +82 -114
  86. data/lib/sisimai/reason/vacation.rb +1 -1
  87. data/lib/sisimai/reason/virusdetected.rb +7 -9
  88. data/lib/sisimai/reason.rb +26 -26
  89. data/lib/sisimai/rfc1123.rb +58 -18
  90. data/lib/sisimai/rfc1894.rb +6 -8
  91. data/lib/sisimai/rfc2045.rb +25 -13
  92. data/lib/sisimai/rfc3464/thirdparty.rb +2 -3
  93. data/lib/sisimai/rfc3464.rb +6 -6
  94. data/lib/sisimai/rfc3834.rb +18 -8
  95. data/lib/sisimai/rfc5322.rb +9 -9
  96. data/lib/sisimai/rfc791.rb +2 -2
  97. data/lib/sisimai/rhost/aol.rb +4 -1
  98. data/lib/sisimai/rhost/apple.rb +15 -11
  99. data/lib/sisimai/rhost/cloudflare.rb +2 -0
  100. data/lib/sisimai/rhost/cox.rb +31 -25
  101. data/lib/sisimai/rhost/facebook.rb +24 -18
  102. data/lib/sisimai/rhost/franceptt.rb +92 -38
  103. data/lib/sisimai/rhost/godaddy.rb +34 -7
  104. data/lib/sisimai/rhost/google.rb +69 -70
  105. data/lib/sisimai/rhost/gsuite.rb +1 -1
  106. data/lib/sisimai/rhost/iua.rb +1 -1
  107. data/lib/sisimai/rhost/kddi.rb +1 -1
  108. data/lib/sisimai/rhost/messagelabs.rb +160 -2
  109. data/lib/sisimai/rhost/microsoft.rb +154 -107
  110. data/lib/sisimai/rhost/mimecast.rb +64 -55
  111. data/lib/sisimai/rhost/nttdocomo.rb +70 -90
  112. data/lib/sisimai/rhost/outlook.rb +1 -1
  113. data/lib/sisimai/rhost/spectrum.rb +8 -8
  114. data/lib/sisimai/rhost/tencent.rb +12 -13
  115. data/lib/sisimai/rhost/yahooinc.rb +9 -10
  116. data/lib/sisimai/rhost/zoho.rb +72 -0
  117. data/lib/sisimai/rhost.rb +4 -3
  118. data/lib/sisimai/smtp/command.rb +4 -2
  119. data/lib/sisimai/smtp/reply.rb +11 -4
  120. data/lib/sisimai/smtp/status.rb +67 -98
  121. data/lib/sisimai/smtp/transcript.rb +3 -3
  122. data/lib/sisimai/string.rb +4 -23
  123. data/lib/sisimai/version.rb +1 -1
  124. data/lib/sisimai.rb +1 -1
  125. data/set-of-emails/maildir/bsd/lhost-exim-56.eml +40 -40
  126. data/set-of-emails/maildir/bsd/lhost-mfilter-05.eml +41 -0
  127. data/set-of-emails/maildir/bsd/lhost-mimecast-01.eml +46 -0
  128. data/set-of-emails/maildir/bsd/lhost-mimecast-02.eml +59 -0
  129. data/set-of-emails/maildir/bsd/lhost-postfix-79.eml +81 -0
  130. data/set-of-emails/maildir/bsd/lhost-postfix-80.eml +84 -0
  131. data/set-of-emails/maildir/bsd/lhost-x1-03.eml +26 -0
  132. data/set-of-emails/maildir/bsd/lhost-x1-04.eml +45 -0
  133. data/set-of-emails/maildir/bsd/lhost-x2-07.eml +30 -0
  134. data/set-of-emails/maildir/bsd/rfc3464-66.eml +170 -0
  135. data/set-of-emails/maildir/bsd/rfc3834-06.eml +59 -0
  136. data/set-of-emails/maildir/bsd/rhost-zoho-01.eml +88 -0
  137. data/set-of-emails/maildir/bsd/rhost-zoho-02.eml +86 -0
  138. data/set-of-emails/maildir/bsd/rhost-zoho-03.eml +87 -0
  139. data/set-of-emails/maildir/bsd/rhost-zoho-04.eml +86 -0
  140. data/set-of-emails/maildir/not/rb-issue-368-bug.eml +39 -0
  141. data/sisimai-java.gemspec +1 -1
  142. data/sisimai.gemspec +1 -1
  143. metadata +28 -13
  144. data/lib/sisimai/reason/exceedlimit.rb +0 -47
  145. data/lib/sisimai/reason/speeding.rb +0 -47
  146. data/lib/sisimai/reason/toomanyconn.rb +0 -59
  147. /data/set-of-emails/maildir/bsd/{lhost-mailmarshalsmtp-02.eml → lhost-mailmarshal-02.eml} +0 -0
  148. /data/set-of-emails/maildir/bsd/{lhost-interscanmss-01.eml → lhost-trendmicro-01.eml} +0 -0
  149. /data/set-of-emails/maildir/bsd/{lhost-interscanmss-02.eml → lhost-trendmicro-02.eml} +0 -0
  150. /data/set-of-emails/maildir/bsd/{lhost-interscanmss-03.eml → lhost-trendmicro-03.eml} +0 -0
@@ -8,55 +8,32 @@ module Sisimai
8
8
  module MailboxFull
9
9
  class << self
10
10
  Index = [
11
- '452 insufficient disk space',
12
- 'account disabled temporarly for exceeding receiving limits',
13
- 'account is exceeding their quota',
14
- 'account is over quota',
15
- 'account is temporarily over quota',
16
- 'boite du destinataire pleine',
17
- 'delivery failed: over quota',
18
- 'disc quota exceeded',
19
- 'diskspace quota',
20
- 'does not have enough space',
21
- 'exceeded storage allocation',
22
- 'exceeding its mailbox quota',
23
- 'full mailbox',
24
- 'is over disk quota',
25
- 'is over quota temporarily',
26
- 'mail file size exceeds the maximum size allowed for mail delivery',
27
- 'mail quota exceeded',
28
- 'mailbox exceeded the local limit',
29
- 'mailbox full',
30
- 'mailbox has exceeded its disk space limit',
31
- 'mailbox is full',
32
- 'mailbox over quota',
33
- 'mailbox quota usage exceeded',
34
- 'mailbox size limit exceeded',
35
- 'maildir over quota',
36
- 'maildir delivery failed: userdisk quota ',
37
- 'maildir delivery failed: domaindisk quota ',
38
- 'mailfolder is full',
39
- 'no space left on device',
40
- 'not enough disk space',
41
- 'not enough storage space in',
42
- 'not sufficient disk space',
43
- 'over the allowed quota',
44
- 'quota exceeded',
45
- 'quota violation for',
46
- 'recipient reached disk quota',
47
- 'recipient rejected: mailbox would exceed maximum allowed storage',
48
- 'the recipient mailbox has exceeded its disk space limit',
49
- "the user's space has been used up",
50
- 'the user you are trying to reach is over quota',
51
- 'too much mail data', # @docomo.ne.jp
52
- 'user has exceeded quota, bouncing mail',
53
- 'user has too many messages on the server',
54
- 'user is over quota',
55
- 'user is over the quota',
56
- 'user over quota',
57
- 'user over quota. (#5.1.1)', # qmail-toaster
58
- 'was automatically rejected: quota exceeded',
59
- 'would be over the allowed quota',
11
+ "452 insufficient disk space",
12
+ "account disabled temporarly for exceeding receiving limits",
13
+ "boite du destinataire pleine",
14
+ "exceeded storage allocation",
15
+ "full mailbox",
16
+ "mailbox size limit exceeded",
17
+ "mailbox would exceed maximum allowed storage",
18
+ "mailfolder is full",
19
+ "no space left on device",
20
+ "not sufficient disk space",
21
+ "quota violation for",
22
+ "too much mail data", # @docomo.ne.jp
23
+ "user has exceeded quota, bouncing mail",
24
+ "user has too many messages on the server",
25
+ "user's space has been used up",
26
+ ].freeze
27
+ Pairs = [
28
+ ["account is ", " quota"],
29
+ ["disk", "quota"],
30
+ ["enough ", " space"],
31
+ ["mailbox ", "exceeded", " limit"],
32
+ ["mailbox ", "full"],
33
+ ["mailbox ", "quota"],
34
+ ["maildir ", "quota"],
35
+ ["over ", "quota"],
36
+ ["quota ", "exceeded"],
60
37
  ].freeze
61
38
 
62
39
  def text; return 'mailboxfull'; end
@@ -66,8 +43,9 @@ module Sisimai
66
43
  # @param [String] argv1 String to be matched with regular expressions
67
44
  # @return [Boolean] false: Did not match, true: Matched
68
45
  def match(argv1)
69
- return false unless argv1
46
+ return false if argv1.nil? || argv1.empty?
70
47
  return true if Index.any? { |a| argv1.include?(a) }
48
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
71
49
  return false
72
50
  end
73
51
 
@@ -30,7 +30,7 @@ module Sisimai
30
30
  # @param [String] argv1 String to be matched with regular expressions
31
31
  # @return [Boolean] false: Did not match, true: Matched
32
32
  def match(argv1)
33
- return false unless argv1
33
+ return false if argv1.nil? || argv1.empty?
34
34
  return true if Index.any? { |a| argv1.include?(a) }
35
35
  return false
36
36
  end
@@ -11,22 +11,21 @@ module Sisimai
11
11
  module NetworkError
12
12
  class << self
13
13
  Index = [
14
- 'could not connect and send the mail to',
15
- 'dns records for the destination computer could not be found',
16
- 'hop count exceeded - possible mail loop',
17
- 'host is unreachable',
18
- 'host name lookup failure',
19
- 'host not found, try again',
20
- 'mail forwarding loop for ',
21
- 'malformed name server reply',
22
- 'malformed or unexpected name server reply',
23
- 'maximum forwarding loop count exceeded',
24
- 'message looping',
25
- 'message probably in a routing loop',
26
- 'no route to host',
27
- 'too many hops',
28
- 'unable to resolve route ',
29
- 'unrouteable mail domain',
14
+ "could not connect and send the mail to",
15
+ "dns records for the destination computer could not be found",
16
+ "host is unreachable",
17
+ "host name lookup failure",
18
+ "host not found, try again",
19
+ "maximum forwarding loop count exceeded",
20
+ "no route to host",
21
+ "too many hops",
22
+ "unable to resolve route ",
23
+ "unrouteable mail domain",
24
+ ].freeze
25
+ Pairs = [
26
+ ["malformed", "name server reply"],
27
+ ["mail ", "loop"],
28
+ ["message ", "loop"],
30
29
  ].freeze
31
30
 
32
31
  def text; return 'networkerror'; end
@@ -36,8 +35,9 @@ module Sisimai
36
35
  # @param [String] argv1 String to be matched with regular expressions
37
36
  # @return [Boolean] false: Did not match, true: Matched
38
37
  def match(argv1)
39
- return false unless argv1
38
+ return false if argv1.nil? || argv1.empty?
40
39
  return true if Index.any? { |a| argv1.include?(a) }
40
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
41
41
  return false
42
42
  end
43
43
 
@@ -10,27 +10,26 @@ module Sisimai
10
10
  module NoRelaying
11
11
  class << self
12
12
  Index = [
13
- 'as a relay',
14
- 'email address is not verified.',
15
- 'insecure mail relay',
16
- 'is not permitted to relay through this server without authentication',
17
- 'mail server requires authentication when attempting to send to a non-local e-mail address', # MailEnable
18
- 'no relaying',
19
- 'not a gateway',
20
- 'not allowed to relay through this machine',
21
- 'not an open relay, so get lost',
22
- 'not local host',
23
- 'relay access denied',
24
- 'relay denied',
25
- 'relay not permitted',
26
- 'relaying denied', # Sendmail
27
- 'relaying mail to ',
28
- 'specified domain is not allowed',
29
- "that domain isn't in my list of allowed rcpthost",
30
- 'this system is not configured to relay mail',
31
- 'unable to relay for',
13
+ "as a relay",
14
+ "domain isn't in my list of allowed rcpthost",
15
+ "email address is not verified.",
16
+ "insecure mail relay",
17
+ "no relaying",
18
+ "not a gateway",
19
+ "not an open relay, so get lost",
20
+ "not local host",
21
+ "relay not permitted",
22
+ "relaying denied", # Sendmail
23
+ "relaying mail to ",
24
+ "send to a non-local e-mail address", # MailEnable
25
+ "specified domain is not allowed",
26
+ "unable to relay ",
32
27
  "we don't handle mail for",
33
28
  ].freeze
29
+ Pairs = [
30
+ ["relay ", "denied"],
31
+ [" not ", " to relay"],
32
+ ].freeze
34
33
 
35
34
  def text; return 'norelaying'; end
36
35
  def description; return 'Email rejected with error message "Relaying Denied"'; end
@@ -39,8 +38,9 @@ module Sisimai
39
38
  # @param [String] argv1 String to be matched with regular expressions
40
39
  # @return [Boolean] false: Did not match, true: Matched
41
40
  def match(argv1)
42
- return false unless argv1
41
+ return false if argv1.nil? || argv1.empty?
43
42
  return true if Index.any? { |a| argv1.include?(a) }
43
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
44
44
  return false
45
45
  end
46
46
 
@@ -11,14 +11,11 @@ module Sisimai
11
11
  class << self
12
12
  # Destination mail server does not accept any message
13
13
  Index = [
14
- 'does not accept mail (nullmx)',
15
- 'host/domain does not accept mail', # iCloud
16
- 'host does not accept mail', # Sendmail
17
- 'mail receiving disabled',
18
- 'name server: .: host not found', # Sendmail
19
- 'no mx record found for domain=', # Oath(Yahoo!)
20
- 'no route for current request',
21
- 'smtp protocol returned a permanent error',
14
+ "does not accept mail", # Sendmail, iCloud
15
+ "mail receiving disabled",
16
+ "name server: .: host not found", # Sendmail
17
+ "no mx record found for domain=", # Oath(Yahoo!)
18
+ "no route for current request",
22
19
  ].freeze
23
20
 
24
21
  def text; return 'notaccept'; end
@@ -28,7 +25,7 @@ module Sisimai
28
25
  # @param [String] argv1 String to be matched with regular expressions
29
26
  # @return [Boolean] false: Did not match, true: Matched
30
27
  def match(argv1)
31
- return false unless argv1
28
+ return false if argv1.nil? || argv1.empty?
32
29
  return true if Index.any? { |a| argv1.include?(a) }
33
30
  return false
34
31
  end
@@ -41,7 +38,7 @@ module Sisimai
41
38
  def true(argvs)
42
39
  return true if argvs['reason'] == 'notaccept'
43
40
  return true if [521, 556].index(argvs['replycode'].to_i) # SMTP Reply Code is 554 or 556
44
- return false if argvs['command'] != 'MAIL'
41
+ return false if Sisimai::SMTP::Command::BeforeRCPT.include?(argvs['command'])
45
42
  return match(argvs['diagnosticcode'].downcase)
46
43
  end
47
44
 
@@ -7,16 +7,13 @@ module Sisimai
7
7
  # example, there are multiple "Subject" headers in the email.
8
8
  module NotCompliantRFC
9
9
  class << self
10
- require 'sisimai/string'
11
10
  Index = [
12
- 'duplicate header',
13
- 'this message is not rfc 5322 compliant',
14
- 'https://support.google.com/mail/?p=rfcmessagenoncompliant',
11
+ "duplicate header",
12
+ "message is not rfc 5322 compliant",
13
+ "multiple addresses in from: header are not accepted",
14
+ "rfc 1035 violation",
15
+ "https://support.google.com/mail/?p=rfcmessagenoncompliant",
15
16
  ].freeze
16
- Pairs = [
17
- [' multiple ', ' header'],
18
- ].freeze
19
-
20
17
 
21
18
  def text; return 'notcompliantrfc'; end
22
19
  def description; return 'Email rejected due to non-compliance with RFC'; end
@@ -25,9 +22,8 @@ module Sisimai
25
22
  # @param [String] argv1 String to be matched with regular expressions
26
23
  # @return [Boolean] false: Did not match, true: Matched
27
24
  def match(argv1)
28
- return false unless argv1
25
+ return false if argv1.nil? || argv1.empty?
29
26
  return true if Index.any? { |a| argv1.include?(a) }
30
- return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
31
27
  return false
32
28
  end
33
29
 
@@ -14,36 +14,21 @@ module Sisimai
14
14
  #
15
15
  module PolicyViolation
16
16
  class << self
17
- require 'sisimai/string'
18
-
19
17
  Index = [
20
- 'an illegal attachment on your message',
21
- 'because the recipient is not accepting mail with ', # AOL Phoenix
22
- 'by non-member to a members-only list',
23
- 'closed mailing list',
24
- 'denied by policy',
25
- 'email not accepted for policy reasons',
18
+ "because the recipient is not accepting mail with ", # AOL Phoenix
19
+ "closed mailing list",
20
+ "delivery not authorized, message refused",
21
+ "denied by policy",
26
22
  # http://kb.mimecast.com/Mimecast_Knowledge_Base/Administration_Console/Monitoring/Mimecast_SMTP_Error_Codes#554
27
- 'email rejected due to security policies',
28
- 'header are not accepted',
29
- 'header error',
30
- 'local policy violation',
31
- 'message bounced due to organizational settings',
32
- 'message given low priority',
33
- 'message not accepted for policy reasons',
34
- 'message rejected due to local policy',
35
- 'messages with multiple addresses',
36
- 'rejected for policy reasons',
37
- 'protocol violation',
38
- 'the email address used to send your message is not subscribed to this group',
39
- 'the message was rejected by organization policy',
40
- 'this message was blocked because its content presents a potential',
41
- 'we do not accept messages containing images or other attachments',
23
+ "email rejected due to security policies",
24
+ "for policy reasons",
25
+ "local policy violation",
26
+ "message bounced due to organizational settings",
27
+ "message given low priority",
28
+ "message was rejected by organization policy",
29
+ "protocol violation",
42
30
  "you're using a mass mailer",
43
31
  ].freeze
44
- Pairs = [
45
- ['you have exceeded the', 'allowable number of posts without solving a captcha'],
46
- ].freeze
47
32
 
48
33
  def text; return 'policyviolation'; end
49
34
  def description; return 'Email rejected due to policy violation on a destination host'; end
@@ -53,9 +38,8 @@ module Sisimai
53
38
  # @return [Boolean] false: Did not match, true: Matched
54
39
  # @since 4.22.0
55
40
  def match(argv1)
56
- return false unless argv1
41
+ return false if argv1.nil? || argv1.empty?
57
42
  return true if Index.any? { |a| argv1.include?(a) }
58
- return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
59
43
  return false
60
44
  end
61
45
 
@@ -0,0 +1,62 @@
1
+ module Sisimai
2
+ module Reason
3
+ # Sisimai::Reason::RateLimited checks the bounce reason is "ratelimited" or not. This class is
4
+ # called only Sisimai::Reason class.
5
+ #
6
+ # This is the error that SMTP connection was rejected temporarily due to too many recipients or
7
+ # too many concurrency connections to the remote server. This reason has added in Sisimai 4.1.26.
8
+ #
9
+ # <kijitora@example.ne.jp>: host mx02.example.ne.jp[192.0.1.20] said:
10
+ # 452 4.3.2 Connection rate limit exceeded. (in reply to MAIL FROM command)
11
+ module RateLimited
12
+ class << self
13
+ Index = [
14
+ "has exceeded the max emails per hour ",
15
+ "please try again slower",
16
+ "receiving mail at a rate that prevents additional messages from being delivered",
17
+ "temporarily deferred due to unexpected volume or user complaints",
18
+ "throttling failure: ",
19
+ "too many errors from your ip", # Free.fr
20
+ "too many recipients", # ntt docomo
21
+ "too many smtp sessions for this host", # Sendmail(daemon.c)
22
+ "trop de connexions, ",
23
+ "we have already made numerous attempts to deliver this message",
24
+ ].freeze
25
+ Pairs = [
26
+ ["exceeded ", "allowable number of posts without solving a captcha"],
27
+ ["connection ", "limit"],
28
+ ["temporarily", "rate limited"],
29
+ ["too many con", "s"],
30
+ ].freeze
31
+
32
+ def text; return 'ratelimited'; end
33
+ def description; return 'SMTP connection rejected temporarily due to too many concurrency connections to the remote host'; end
34
+
35
+ # Try to match that the given text and regular expressions
36
+ # @param [String] argv1 String to be matched with regular expressions
37
+ # @return [Boolean] false: Did not match, true: Matched
38
+ def match(argv1)
39
+ return false if argv1.nil? || argv1.empty?
40
+ return true if Index.any? { |a| argv1.include?(a) }
41
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
42
+ return false
43
+ end
44
+
45
+ # Rejected by domain or address filter ?
46
+ # @param [Sisimai::Fact] argvs Object to be detected the reason
47
+ # @return [Boolean] true: is rate limited
48
+ # false: is not rate limited
49
+ # @see http://www.ietf.org/rfc/rfc2822.txt
50
+ def true(argvs)
51
+ return true if argvs['reason'] == 'ratelimited'
52
+ return true if Sisimai::SMTP::Status.name(argvs['deliverystatus']) == 'ratelimited'
53
+ return match(argvs['diagnosticcode'].downcase)
54
+ end
55
+
56
+ end
57
+ end
58
+ end
59
+ end
60
+
61
+
62
+
@@ -14,66 +14,53 @@ module Sisimai
14
14
  module Rejected
15
15
  class << self
16
16
  IsNot = [
17
- '5.1.0 address rejected',
18
- 'recipient address rejected',
19
- 'sender ip address rejected',
17
+ "5.1.0 address rejected",
18
+ "ip address ",
19
+ "recipient address rejected",
20
20
  ].freeze
21
21
  Index = [
22
- 'access denied (in reply to mail from command)',
23
- 'access denied (sender blacklisted)',
24
- 'address rejected',
25
- 'administrative prohibition',
26
- 'batv failed to verify', # SoniWall
27
- 'batv validation failure', # SoniWall
28
- 'backscatter protection detected an invalid or expired email address', # MDaemon
29
- "because the sender isn't on the recipient's list of senders to accept mail from",
30
- 'bogus mail from', # IMail - block empty sender
22
+ "access denied (in reply to mail from command)",
23
+ "administrative prohibition",
24
+ "all recipient addresses rejected : access denied",
25
+ "backscatter protection detected an invalid or expired email address", # MDaemon
26
+ "by non-member to a members-only list",
31
27
  "can't determine purported responsible address",
32
- 'connections not accepted from servers without a valid sender domain',
33
- 'denied [bouncedeny]', # McAfee
34
- 'denied by secumail valid-address-filter',
35
- 'delivery not authorized, message refused',
36
- 'does not exist e2110',
37
- 'domain of sender address ',
38
- 'email address is on senderfilterconfig list',
39
- 'emetteur invalide',
40
- 'empty envelope senders not allowed',
41
- 'envelope blocked - ',
42
- 'error: no third-party dsns', # SpamWall - block empty sender
43
- 'from: domain is invalid. please provide a valid from:',
44
- 'fully qualified email address required', # McAfee
45
- 'invalid domain, see <url:',
46
- 'invalid sender',
47
- 'is not a registered gateway user',
48
- 'mail from not owned by user',
49
- 'message rejected: email address is not verified',
50
- 'mx records for ',
51
- 'null sender is not allowed',
52
- 'recipient addresses rejected : access denied',
53
- 'recipient not accepted. (batv: no tag',
54
- 'returned mail not accepted here',
55
- 'rfc 1035 violation: recursive cname records for',
56
- 'rule imposed mailbox access for', # MailMarshal
57
- 'sending this from a different address or alias using the ',
58
- 'sender address has been blacklisted',
59
- 'sender email address rejected',
60
- 'sender is in my black list',
61
- 'sender is spammer',
62
- 'sender not pre-approved',
63
- 'sender rejected',
64
- 'sender domain is empty',
65
- 'sender verify failed', # Exim callout
66
- 'sender was rejected', # qmail
67
- 'spam reporting address', # SendGrid|a message to an address has previously been marked as Spam by the recipient.
68
- 'syntax error: empty email address',
69
- 'the message has been rejected by batv defense',
70
- 'this server does not accept mail from',
71
- 'transaction failed unsigned dsn for',
72
- 'unroutable sender address',
73
- 'you are not allowed to post to this mailing list',
74
- 'you are sending to/from an address that has been blacklisted',
75
- 'your access to submit messages to this e-mail system has been rejected',
76
- 'your email address has been blacklisted', # MessageLabs
28
+ "connections not accepted from servers without a valid sender domain",
29
+ "denied by secumail valid-address-filter", # SecuMail
30
+ "domain of sender address ",
31
+ "email address is on senderfilterconfig list",
32
+ "emetteur invalide",
33
+ "empty email address",
34
+ "empty envelope senders not allowed",
35
+ "from: domain is invalid. please provide a valid from:",
36
+ "fully qualified email address required", # McAfee
37
+ "invalid sender",
38
+ "is not a registered gateway user",
39
+ "mail from not owned by user",
40
+ "mailfrom domain is listed in spamhaus",
41
+ "null sender is not allowed",
42
+ "returned mail not accepted here",
43
+ "sending this from a different address or alias using the ",
44
+ "sender is spammer",
45
+ "sender not pre-approved",
46
+ "sender domain is empty",
47
+ "sender domain listed at ",
48
+ "sender verify failed", # Exim callout
49
+ "server does not accept mail from",
50
+ "spam reporting address", # SendGrid|a message to an address has previously been marked as Spam by the recipient.
51
+ "unroutable sender address",
52
+ "you are not allowed to post to this mailing list",
53
+ "your access to submit messages to this e-mail system has been rejected",
54
+ "your email address has been blacklisted", # MessageLabs
55
+ ].freeze
56
+ Pairs = [
57
+ ["after end of data:", ".", " does not exist"],
58
+ ["after mail from:", ".", " does not exist"],
59
+ ["domain ", " is a dead domain"],
60
+ ["email address ", "is not "],
61
+ ["send", "blacklisted"],
62
+ ["sender", " rejected"],
63
+ ["sender is", " list"],
77
64
  ].freeze
78
65
 
79
66
  def text; return 'rejected'; end
@@ -83,9 +70,10 @@ module Sisimai
83
70
  # @param [String] argv1 String to be matched with regular expressions
84
71
  # @return [Boolean] false: Did not match, true: Matched
85
72
  def match(argv1)
86
- return false unless argv1
73
+ return false if argv1.nil? || argv1.empty?
87
74
  return false if IsNot.any? { |a| argv1.include?(a) }
88
75
  return true if Index.any? { |a| argv1.include?(a) }
76
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
89
77
  return false
90
78
  end
91
79
 
@@ -6,35 +6,23 @@ module Sisimai
6
6
  # SMTP connection.
7
7
  module RequirePTR
8
8
  class << self
9
- require 'sisimai/string'
10
-
11
9
  Index = [
12
- 'access denied. ip name lookup failed',
13
- 'all mail servers must have a ptr record with a valid reverse dns entry',
14
- 'bad dns ptr resource record',
15
- 'cannot find your hostname',
10
+ "cannot find your hostname",
16
11
  "cannot resolve your address.",
17
- 'client host rejected: cannot find your hostname', # Yahoo!
18
- 'fix reverse dns for ',
19
- 'ips with missing ptr records',
20
- 'no ptr record found.',
21
- 'please get a custom reverse dns name from your isp for your host',
22
- 'ptr record setup',
23
- 'reverse dns failed',
24
- 'reverse dns required',
25
- 'sender ip reverse lookup rejected',
26
- 'the ip address sending this message does not have a ptr record setup', # Google
27
- 'the corresponding forward dns entry does not point to the sending ip', # Google
28
- 'this system will not accept messages from servers/devices with no reverse dns',
29
- 'unresolvable relay host name',
30
- 'we do not accept mail from hosts with dynamic ip or generic dns ptr-records',
12
+ "corresponding forward dns entry does not point to the sending ip", # Google
13
+ "ip name lookup failed",
14
+ "no matches to nameserver query",
15
+ "sender ip reverse lookup rejected",
16
+ "unresolvable relay host name",
31
17
  ].freeze
32
18
  Pairs = [
33
- ['domain ',' mismatches client ip'],
34
- ['dns lookup failure: ', ' try again later'],
35
- ['reverse dns lookup for host ', ' failed permanently'],
36
- ['server access ', ' forbidden by invalid rdns record of your mail server'],
37
- ['service permits ', ' unverifyable sending ips'],
19
+ ["domain "," mismatches client ip"],
20
+ ["domain name verification on your ip address ", "failed"],
21
+ ["dns lookup failure: ", " try again later"],
22
+ ["ptr", "record"],
23
+ ["reverse", " dns"],
24
+ ["server access ", " forbidden by invalid rdns record of your mail server"],
25
+ ["service permits ", " unverifyable sending ips"],
38
26
  ].freeze
39
27
 
40
28
  def text; return 'requireptr'; end
@@ -44,7 +32,7 @@ module Sisimai
44
32
  # @param [String] argv1 String to be matched with regular expressions
45
33
  # @return [Boolean] false: Did not match, true: Matched
46
34
  def match(argv1)
47
- return false unless argv1
35
+ return false if argv1.nil? || argv1.empty?
48
36
  return true if Index.any? { |a| argv1.include?(a) }
49
37
  return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
50
38
  return false