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
data/lib/sisimai/order.rb CHANGED
@@ -11,7 +11,7 @@ module Sisimai
11
11
  'Sisimai::Lhost::Sendmail',
12
12
  'Sisimai::Lhost::Exchange2007',
13
13
  'Sisimai::Lhost::Exchange2003',
14
- 'Sisimai::Lhost::InterScanMSS',
14
+ 'Sisimai::Lhost::TrendMicro',
15
15
  'Sisimai::Lhost::KDDI',
16
16
  'Sisimai::Lhost::FML',
17
17
  'Sisimai::Lhost::Verizon',
@@ -38,7 +38,7 @@ module Sisimai
38
38
  'Sisimai::Lhost::MFILTER',
39
39
  'Sisimai::Lhost::MailFoundry',
40
40
  'Sisimai::Lhost::GoogleGroups',
41
- 'Sisimai::Lhost::MailMarshalSMTP',
41
+ 'Sisimai::Lhost::MailMarshal',
42
42
  'Sisimai::Lhost::V5sendmail',
43
43
  'Sisimai::Lhost::EZweb',
44
44
  'Sisimai::Lhost::Biglobe',
@@ -84,7 +84,7 @@ module Sisimai
84
84
  'Sisimai::Lhost::Zoho',
85
85
  'Sisimai::Lhost::EinsUndEins',
86
86
  ],
87
- 'mail-could' => ['Sisimai::Lhost::InterScanMSS'],
87
+ 'mail-could' => ['Sisimai::Lhost::TrendMicro'],
88
88
  'mail-failure' => ['Sisimai::Lhost::Exim'],
89
89
  'mail-system' => ['Sisimai::Lhost::EZweb'],
90
90
  'message-delivery' => ['Sisimai::Lhost::MailFoundry'],
@@ -92,6 +92,7 @@ module Sisimai
92
92
  'non-recapitabile' => ['Sisimai::Lhost::Exchange2007'],
93
93
  'non-remis' => ['Sisimai::Lhost::Exchange2007'],
94
94
  'notice' => ['Sisimai::Lhost::Courier'],
95
+ 'postmaster-email' => ['Sisimai::Lhost::Mimecast'],
95
96
  'postmaster-notify' => ['Sisimai::Lhost::Sendmail'],
96
97
  'returned-mail' => [
97
98
  'Sisimai::Lhost::Sendmail',
@@ -101,7 +102,7 @@ module Sisimai
101
102
  ],
102
103
  'there-was' => ['Sisimai::Lhost::X6'],
103
104
  'undeliverable' => ['Sisimai::Lhost::Exchange2007', 'Sisimai::Lhost::Exchange2003'],
104
- 'undeliverable-mail' => ['Sisimai::Lhost::MailMarshalSMTP', 'Sisimai::Lhost::IMailServer'],
105
+ 'undeliverable-mail' => ['Sisimai::Lhost::MailMarshal', 'Sisimai::Lhost::IMailServer'],
105
106
  'undeliverable-message' => ['Sisimai::Lhost::Notes', 'Sisimai::Lhost::Verizon'],
106
107
  'undelivered-mail' => ['Sisimai::Lhost::Postfix', 'Sisimai::Lhost::Zoho'],
107
108
  'warning' => ['Sisimai::Lhost::Sendmail', 'Sisimai::Lhost::Exim'],
@@ -12,23 +12,19 @@ module Sisimai
12
12
  # Diagnostic-Code: smtp; 550 5.7.1 Email rejected per DMARC policy for example.org
13
13
  module AuthFailure
14
14
  class << self
15
- require 'sisimai/string'
16
-
17
15
  Index = [
18
- '//spf.pobox.com',
19
- 'bad spf records for',
20
- 'dmarc policy',
16
+ "//spf.pobox.com",
17
+ "5322.From address doesn't meet the authentication requirements",
18
+ "bad spf records for",
19
+ "dmarc policy",
21
20
  "doesn't meet the required authentication level",
22
- 'please inspect your spf settings',
23
- 'sender policy framework (spf) fail',
24
- 'sender policy framework violation',
25
- 'spf (sender policy framework) domain authentication fail',
26
- 'spf check: fail',
27
- "the 5322.From address doesn't meet the authentication requirements defined for the sender",
21
+ "please inspect your spf settings",
22
+ "sender policy framework",
23
+ "spf check: fail",
28
24
  ].freeze
29
25
  Pairs = [
30
- [' is not allowed to send mail.', '_401'],
31
- ['is not allowed to send from <', " per it's spf record"],
26
+ [" is not allowed to send mail.", "_401"],
27
+ ["is not allowed to send from <", " per it's spf record"],
32
28
  ].freeze
33
29
 
34
30
  def text; return 'authfailure'; end
@@ -38,7 +34,7 @@ module Sisimai
38
34
  # @param [String] argv1 String to be matched with regular expressions
39
35
  # @return [Boolean] false: Did not match, true: Matched
40
36
  def match(argv1)
41
- return false unless argv1
37
+ return false if argv1.nil? || argv1.empty?
42
38
  return true if Index.any? { |a| argv1.include?(a) }
43
39
  return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
44
40
  return false
@@ -15,13 +15,13 @@ module Sisimai
15
15
  module BadReputation
16
16
  class << self
17
17
  Index = [
18
- 'a poor email reputation score',
19
- 'has been temporarily rate limited due to ip reputation',
20
- 'ip/domain reputation problems',
21
- 'likely suspicious due to the very low reputation',
22
- 'none/bad reputation', # t-online.de
23
- 'temporarily deferred due to unexpected volume or user complaints', # Yahoo Inc.
24
- "the sending mta's poor reputation",
18
+ "has been temporarily rate limited due to ip reputation",
19
+ "ip/domain reputation problems",
20
+ "likely suspicious due to the very low reputation",
21
+ "none/bad reputation", # t-online.de
22
+ "poor email reputation score",
23
+ "sending mta's poor reputation",
24
+ "temporarily deferred due to unexpected volume or user complaints", # Yahoo Inc.
25
25
  ].freeze
26
26
  def text; return 'badreputation'; end
27
27
  def description; return 'Email rejected due to an IP address reputation'; end
@@ -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
@@ -7,92 +7,67 @@ module Sisimai
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/string'
11
-
12
10
  Index = [
13
- ' said: 550 blocked',
14
- '//www.spamcop.net/bl.',
15
- 'bad sender ip address',
16
- 'banned sending ip', # Office365
17
- 'blacklisted by',
18
- 'blocked using ',
19
- 'blocked - see http',
20
- 'dnsbl:attrbl',
21
- 'client host rejected: abus detecte gu_eib_02', # SFR
22
- 'client host rejected: abus detecte gu_eib_04', # SFR
23
- 'client host rejected: may not be mail exchanger',
24
- 'client host rejected: was not authenticated', # Microsoft
25
- 'confirm this mail server',
26
- 'connection dropped',
27
- 'connection refused by',
28
- 'connection reset by peer',
29
- 'connection was dropped by remote host',
30
- 'connections not accepted from ip addresses on spamhaus xbl',
31
- 'currently sending spam see: ',
32
- 'domain does not exist:',
33
- 'dynamic/zombied/spam ips blocked',
34
- 'error: no valid recipients from ',
35
- 'esmtp not accepting connections', # icloud.com
36
- 'extreme bad ip profile',
37
- 'go away',
38
- 'helo command rejected:',
39
- 'host network not allowed',
40
- 'hosts with dynamic ip',
41
- 'invalid ip for sending mail of domain',
42
- 'is in a black list',
43
- 'is not allowed to send mail from',
44
- 'no access from mail server',
45
- 'no matches to nameserver query',
46
- 'not currently accepting mail from your ip', # Microsoft
47
- 'part of their network is on our block list',
48
- 'please use the smtp server of your isp',
49
- 'refused - see http',
50
- 'rejected - multi-blacklist', # junkemailfilter.com
51
- 'rejected because the sending mta or the sender has not passed validation',
52
- 'rejecting open proxy', # Sendmail(srvrsmtp.c)
53
- 'sender ip address rejected',
54
- 'server access forbidden by your ip ',
55
- 'service not available, closing transmission channel',
56
- 'smtp error from remote mail server after initial connection:', # Exim
57
- "sorry, that domain isn't in my list of allowed rcpthosts",
58
- 'sorry, your remotehost looks suspiciously like spammer',
59
- 'temporarily deferred due to unexpected volume or user complaints',
60
- 'to submit messages to this e-mail system has been rejected',
61
- 'too many spams from your ip', # free.fr
62
- 'too many unwanted messages have been sent from the following ip address above',
63
- 'was blocked by ',
64
- 'we do not accept mail from dynamic ips', # @mail.ru
65
- 'you are not allowed to connect',
66
- 'you are sending spam',
67
- 'your ip address is listed in the rbl',
68
- 'your network is temporary blacklisted',
69
- 'your server requires confirmation',
11
+ "bad sender ip address",
12
+ "banned sending ip", # Office365
13
+ "blacklisted by",
14
+ "dnsbl:attrbl",
15
+ "client host rejected: abus detecte gu_eib_02", # SFR
16
+ "client host rejected: abus detecte gu_eib_04", # SFR
17
+ "client host rejected: may not be mail exchanger",
18
+ "connection refused by",
19
+ "currently sending spam see: ",
20
+ "domain does not exist:",
21
+ "domain isn't in my list of allowed rcpthosts",
22
+ "error: no valid recipients from ",
23
+ "esmtp not accepting connections", # icloud.com
24
+ "extreme bad ip profile",
25
+ "helo command rejected:",
26
+ "host network not allowed",
27
+ "invalid ip for sending mail of domain",
28
+ "is in a black list",
29
+ "is not allowed to send mail from",
30
+ "no access from mail server",
31
+ "part of their network is on our block list",
32
+ "please use the smtp server of your isp",
33
+ "rejected because the sending mta or the sender has not passed validation",
34
+ "rejecting open proxy", # Sendmail(srvrsmtp.c)
35
+ "sender ip address rejected",
36
+ "server access forbidden by your ip ",
37
+ "smtp error from remote mail server after initial connection:", # Exim
38
+ "you are not allowed to connect",
39
+ "your ip address is listed in the rbl",
40
+ "your network is temporary blacklisted",
41
+ "your remotehost looks suspiciously like spammer",
42
+ "your server requires confirmation",
70
43
  ].freeze
71
44
  Pairs = [
72
- ['(', '@', ':blocked)'],
73
- ['access from ip address ', ' blocked'],
74
- ['client host ', ' blocked using'],
75
- ['connections will not be accepted from ', " because the ip is in spamhaus's list"],
76
- ['dnsbl:rbl ', '>_is_blocked'],
77
- ['email blocked by ', '.barracudacentral.org'],
78
- ['email blocked by ', 'spamhaus'],
79
- ['host ', ' refused to talk to me: ', ' blocked'],
80
- ['ip ', ' is blocked by earthlink'], # Earthlink
81
- ['is in an ', 'rbl on '],
82
- ['mail server at ', ' is blocked'],
83
- ['mail from ',' refused:'],
84
- ["mail from "," refused, see ", "orbs"],
85
- ['message from ', ' rejected based on blacklist'],
86
- ['messages from ', ' temporarily deferred due to user complaints'], # Yahoo!
87
- ['server ip ', ' listed as abusive'],
88
- ['sorry! your ip address', ' is blocked by rbl'], # junkemailfilter.com
89
- ['the domain ', ' is blacklisted'],
90
- ['the email ', ' is blacklisted'],
91
- ['the ip', ' is blacklisted'],
92
- ['veuillez essayer plus tard. service refused, please try later. ', '103'],
93
- ['veuillez essayer plus tard. service refused, please try later. ', '510'],
45
+ ["(", "@", ":blocked)"],
46
+ ["access from ip address ", " blocked"],
47
+ ["blocked by ", " dnsbl"],
48
+ ["client ", " blocked using"],
49
+ ["connection ", "dropped"],
50
+ ["client host ", " blocked using"],
51
+ ["connections will not be accepted from ", " because the ip is in spamhaus's list"],
52
+ ["dynamic", " ip"],
53
+ ["email blocked by ", ".barracudacentral.org"],
54
+ ["email blocked by ", "spamhaus"],
55
+ ["from ", " ip address"],
56
+ ["host ", " said: ", "550 blocked"],
57
+ ["host ", " refused to talk to me: ", " blocked"],
58
+ ["ip ", " is blocked by earthlink"], # Earthlink
59
+ ["is in an ", "rbl on "],
60
+ ["mail server at ", " is blocked"],
61
+ ["mail from "," refused"],
62
+ ["message from ", " rejected based on blacklist"],
63
+ ["messages from ", " temporarily deferred due to user complaints"], # Yahoo!
64
+ ["server ip ", " listed as abusive"],
65
+ ["sorry! your ip address", " is blocked by rbl"], # junkemailfilter.com
66
+ ["the ", " is blacklisted"], # the email, the domain, the ip
67
+ ["veuillez essayer plus tard. service refused, please try later. ", "103"],
68
+ ["veuillez essayer plus tard. service refused, please try later. ", "510"],
94
69
  ["your access ip", " has been rejected"],
95
- ["your sender's ip address is listed at ", '.abuseat.org'],
70
+ ["your sender's ip address is listed at ", ".abuseat.org"],
96
71
  ].freeze
97
72
 
98
73
  def text; return 'blocked'; end
@@ -102,7 +77,7 @@ module Sisimai
102
77
  # @param [String] argv1 String to be matched with regular expressions
103
78
  # @return [Boolean] false: Did not match, true: Matched
104
79
  def match(argv1)
105
- return false unless argv1
80
+ return false if argv1.nil? || argv1.empty?
106
81
  return true if Index.any? { |a| argv1.include?(a) }
107
82
  return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
108
83
  return false
@@ -9,15 +9,20 @@ module Sisimai
9
9
  module ContentError
10
10
  class << self
11
11
  Index = [
12
- 'duplicate header',
13
- 'header size exceeds maximum permitted',
14
- 'improper use of 8-bit data in message header',
15
- 'message header size, or recipient list, exceeds policy limit',
16
- 'message mime complexity exceeds the policy maximum',
17
- 'routing loop detected -- too many received: headers',
18
- 'this message contain invalid mime headers',
19
- 'this message contain improperly-formatted binary content',
20
- 'this message contain text that uses unnecessary base64 encoding',
12
+ "executable files are not allowed in compressed files",
13
+ "header error",
14
+ "header size exceeds maximum permitted",
15
+ "illegal attachment on your message",
16
+ "improper use of 8-bit data in message header",
17
+ "it has a potentially executable attachment",
18
+ "message contain invalid mime headers",
19
+ "message contain improperly-formatted binary content",
20
+ "message contain text that uses unnecessary base64 encoding",
21
+ "message header size, or recipient list, exceeds policy limit",
22
+ "message mime complexity exceeds the policy maximum",
23
+ "message was blocked because its content presents a potential", # https://support.google.com/mail/answer/6590
24
+ "routing loop detected -- too many received: headers",
25
+ "we do not accept messages containing images or other attachments",
21
26
  ].freeze
22
27
 
23
28
  def text; return 'contenterror'; end
@@ -27,7 +32,7 @@ module Sisimai
27
32
  # @param [String] argv1 String to be matched with regular expressions
28
33
  # @return [Boolean] false: Did not match, true: Matched
29
34
  def match(argv1)
30
- return false unless argv1
35
+ return false if argv1.nil? || argv1.empty?
31
36
  return true if Index.any? { |a| argv1.include?(a) }
32
37
  return false
33
38
  end
@@ -2,35 +2,34 @@ 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 "mesgtoobig" to the reason of email bounce if the value of Status: field in a bounce email
6
- # is "5.3.4".
7
- module MesgTooBig
5
+ # set "emailtoolarge" to the reason of email bounce if the value of Status: field in a bounce
6
+ # email is "5.2.3" or "5.3.4".
7
+ module EmailTooLarge
8
8
  class << self
9
9
  Index = [
10
- 'exceeded maximum inbound message size',
11
- 'exceeded the maximum incoming message size',
12
- 'line limit exceeded',
13
- 'max message size exceeded',
14
- 'message file too big',
15
- 'message length exceeds administrative limit',
16
- 'message size exceeds fixed limit',
17
- 'message size exceeds fixed maximum message size',
18
- 'message size exceeds maximum value',
19
- 'message too big',
20
- 'message too large for this ',
21
- 'size limit',
22
- 'taille limite du message atteinte',
10
+ "line limit exceeded",
11
+ "mail file size exceeds the maximum size allowed for mail delivery",
12
+ "message too large",
13
+ "size limit",
14
+ "taille limite du message atteinte",
15
+ ].freeze
16
+ Pairs = [
17
+ ["exceeded", "message size"],
18
+ ["message ", "exceeds ", "limit"],
19
+ ["message ", "size", "exceed"],
20
+ ["message ", "too", "big"],
23
21
  ].freeze
24
22
 
25
- def text; return 'mesgtoobig'; end
23
+ def text; return 'emailtoolarge'; end
26
24
  def description; return 'Email rejected due to an email size is too big for a destination mail server'; end
27
25
 
28
26
  # Try to match that the given text and regular expressions
29
27
  # @param [String] argv1 String to be matched with regular expressions
30
28
  # @return [Boolean] false: Did not match, true: Matched
31
29
  def match(argv1)
32
- return false unless argv1
30
+ return false if argv1.nil? || argv1.empty?
33
31
  return true if Index.any? { |a| argv1.include?(a) }
32
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
34
33
  return false
35
34
  end
36
35
 
@@ -40,18 +39,18 @@ module Sisimai
40
39
  # false: is not big
41
40
  # @see http://www.ietf.org/rfc/rfc2822.txt
42
41
  def true(argvs)
43
- return true if argvs['reason'] == 'mesgtoobig'
42
+ return true if argvs['reason'] == 'emailtoolarge'
44
43
 
45
44
  statuscode = argvs['deliverystatus'] || ''
46
45
  tempreason = Sisimai::SMTP::Status.name(statuscode)
47
46
 
48
- # Delivery status code points "mesgtoobig".
47
+ # Delivery status code points "emailtoolarge".
49
48
  # Status: 5.3.4
50
49
  # Diagnostic-Code: SMTP; 552 5.3.4 Error: message file too big
51
- return true if tempreason == 'mesgtoobig'
52
-
53
- # 5.2.3 Message length exceeds administrative limit
54
- return false if( tempreason == 'exceedlimit' || statuscode == '5.2.3' )
50
+ #
51
+ # Status: 5.2.3
52
+ # Deiagnostic-Code: Message length exceeds administrative limit
53
+ return true if tempreason == 'emailtoolarge'
55
54
  return match(argvs['diagnosticcode'].downcase)
56
55
  end
57
56
 
@@ -60,5 +59,3 @@ module Sisimai
60
59
  end
61
60
  end
62
61
 
63
-
64
-
@@ -7,32 +7,25 @@ module Sisimai
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/string'
11
-
12
10
  Index = [
13
- 'connection timed out',
14
- 'could not find a gateway for',
15
- 'delivery attempts will continue to be',
16
- 'delivery expired',
17
- 'delivery time expired',
18
- 'failed to deliver to domain ',
19
- 'giving up on',
20
- 'have been failing for a long time',
21
- 'has been delayed',
22
- 'it has not been collected after',
23
- 'message expired after sitting in queue for',
24
- 'message expired, cannot connect to remote server',
25
- 'message expired, connection refulsed',
26
- 'message timed out',
27
- 'retry time not reached for any host after a long failure period',
28
- 'server did not respond',
29
- 'this message has been in the queue too long',
30
- 'unable to deliver message after multiple retries',
31
- 'was not reachable within the allowed queue period',
32
- 'your message could not be delivered for more than',
11
+ "connection timed out",
12
+ "could not find a gateway for",
13
+ "delivery attempts will continue to be",
14
+ "failed to deliver to domain ",
15
+ "have been failing for a long time",
16
+ "has been delayed",
17
+ "it has not been collected after",
18
+ "message could not be delivered for more than",
19
+ "message expired, ",
20
+ "message has been in the queue too long",
21
+ "message timed out",
22
+ "server did not respond",
23
+ "unable to deliver message after multiple retries",
33
24
  ].freeze
34
25
  Pairs = [
35
- ['could not be delivered for', ' days'],
26
+ ["could not be delivered for", " days"],
27
+ ["delivery ", "expired"],
28
+ ["not", "reach", "period"],
36
29
  ].freeze
37
30
 
38
31
  def text; return 'expired'; end
@@ -42,7 +35,7 @@ module Sisimai
42
35
  # @param [String] argv1 String to be matched with regular expressions
43
36
  # @return [Boolean] false: Did not match, true: Matched
44
37
  def match(argv1)
45
- return false unless argv1
38
+ return false if argv1.nil? || argv1.empty?
46
39
  return true if Index.any? { |a| argv1.include?(a) }
47
40
  return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
48
41
  return false
@@ -17,7 +17,7 @@ module Sisimai
17
17
  # @param [String] argv1 String to be matched with regular expressions
18
18
  # @return [Boolean] false: Did not match, true: Matched
19
19
  def match(argv1)
20
- return false unless argv1
20
+ return false if argv1.nil? || argv1.empty?
21
21
  return true if Index.any? { |a| argv1.include?(a) }
22
22
  return false
23
23
  end
@@ -10,22 +10,18 @@ module Sisimai
10
10
  module Filtered
11
11
  class << self
12
12
  Index = [
13
- 'because the recipient is only accepting mail from specific email addresses', # AOL Phoenix
14
- 'bounced address', # SendGrid|a message to an address has previously been Bounced.
15
- 'due to extended inactivity new mail is not currently being accepted for this mailbox',
16
- 'has restricted sms e-mail', # AT&T
17
- 'is not accepting any mail',
13
+ "account is protected by",
14
+ "has restricted sms e-mail", # AT&T
15
+ "is not accepting any mail",
18
16
  "message filtered",
19
- 'message rejected due to user rules',
20
- 'not found recipient account',
21
- 'refused due to recipient preferences', # Facebook
22
- 'resolver.rst.notauthorized', # Microsoft Exchange
23
- 'this account is protected by',
24
- 'user not found', # Filter on MAIL.RU
25
- 'user refuses to receive this mail',
26
- 'user reject',
27
- 'we failed to deliver mail because the following address recipient id refuse to receive mail', # Willcom
28
- 'you have been blocked by the recipient',
17
+ "message rejected due to user rules",
18
+ "not found recipient account",
19
+ "recipient id refuse to receive mail", # Willcom
20
+ "recipient is only accepting mail from specific email addresses", # AOL Phoenix
21
+ "refused due to recipient preferences", # Facebook
22
+ "user refuses to receive this mail",
23
+ "user reject",
24
+ "you have been blocked by the recipient",
29
25
  ].freeze
30
26
 
31
27
  def text; return 'filtered'; end
@@ -35,7 +31,7 @@ module Sisimai
35
31
  # @param [String] argv1 String to be matched with regular expressions
36
32
  # @return [Boolean] false: Did not match, true: Matched
37
33
  def match(argv1)
38
- return false unless argv1
34
+ return false if argv1.nil? || argv1.empty?
39
35
  return true if Index.any? { |a| argv1.include?(a) }
40
36
  return false
41
37
  end
@@ -48,7 +44,6 @@ module Sisimai
48
44
  def true(argvs)
49
45
  return true if argvs['reason'] == 'filtered'
50
46
 
51
- require 'sisimai/reason/userunknown'
52
47
  tempreason = Sisimai::SMTP::Status.name(argvs['deliverystatus'])
53
48
  return false if tempreason == 'suspend'
54
49
 
@@ -56,12 +51,13 @@ module Sisimai
56
51
  thecommand = argvs['command'] || ''
57
52
  if tempreason == 'filtered'
58
53
  # Delivery status code points "filtered".
54
+ require 'sisimai/reason/userunknown'
59
55
  return true if Sisimai::Reason::UserUnknown.match(issuedcode) || match(issuedcode)
60
56
  else
61
57
  # The value of "reason" isn't "filtered" when the value of "command" is an SMTP command
62
58
  # to be sent before the SMTP DATA command because all the MTAs read the headers and the
63
59
  # entire message body after the DATA command.
64
- return false if %w[CONN EHLO HELO MAIL RCPT].include?(thecommand)
60
+ return false if Sisimai::SMTP::Command::ExceptDATA.include?(thecommand)
65
61
  return true if match(issuedcode) || Sisimai::Reason::UserUnknown.match(issuedcode)
66
62
  end
67
63
  return false
@@ -17,7 +17,7 @@ module Sisimai
17
17
  # @param [String] argv1 String to be matched with regular expressions
18
18
  # @return [Boolean] false: Did not match, true: Matched
19
19
  def match(argv1)
20
- return false unless argv1
20
+ return false if argv1.nil? || argv1.empty?
21
21
  return true if Index.any? { |a| argv1.include?(a) }
22
22
  return false
23
23
  end
@@ -28,7 +28,8 @@ module Sisimai
28
28
  # false: Has not moved
29
29
  # @see http://www.ietf.org/rfc/rfc2822.txt
30
30
  def true(argvs)
31
- return true if argvs['reason'] == 'hasmoved'
31
+ return true if argvs['reason'] == 'hasmoved'
32
+ return false if Sisimai::SMTP::Command::BeforeRCPT.include?(argvs['command'])
32
33
  return match(argvs['diagnosticcode'].downcase)
33
34
  end
34
35
 
@@ -6,26 +6,22 @@ module Sisimai
6
6
  # Status: field in a bounce mail is "5.1.2".
7
7
  module HostUnknown
8
8
  class << self
9
- require 'sisimai/string'
10
-
11
9
  Index = [
12
- 'domain does not exist',
13
- 'domain is not reachable',
14
- 'domain must exist',
15
- 'host or domain name not found',
16
- 'host unknown',
17
- 'host unreachable',
18
- 'mail domain mentioned in email address is unknown',
19
- 'name or service not known',
20
- 'no such domain',
21
- 'recipient address rejected: unknown domain name',
22
- 'recipient domain must exist',
23
- 'the account or domain may not exist',
24
- 'unknown host',
25
- 'unroutable address',
26
- 'unrouteable address',
10
+ "domain is not reachable",
11
+ "domain mentioned in email address is unknown",
12
+ "domain must exist",
13
+ "host or domain name not found",
14
+ "host unknown",
15
+ "host unreachable",
16
+ "name or service not known",
17
+ "no such domain",
18
+ "recipient address rejected: unknown domain name",
19
+ "unknown host",
20
+ ].freeze
21
+ Pairs = [
22
+ ["domain ", "not exist"],
23
+ ["unrout", "able ", "address"],
27
24
  ].freeze
28
- Pairs = [['553 ', ' does not exist']].freeze
29
25
 
30
26
  def text; return 'hostunknown'; end
31
27
  def description; return "Delivery failed due to a domain part of a recipient's email address does not exist"; end
@@ -35,7 +31,7 @@ module Sisimai
35
31
  # @return [Boolean] false: Did not match, true: Matched
36
32
  # @since v4.0.0
37
33
  def match(argv1)
38
- return false unless argv1
34
+ return false if argv1.nil? || argv1.empty?
39
35
  return true if Index.any? { |a| argv1.include?(a) }
40
36
  return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
41
37
  return false
@@ -47,7 +43,8 @@ module Sisimai
47
43
  # false: is not unknown host.
48
44
  # @see http://www.ietf.org/rfc/rfc2822.txt
49
45
  def true(argvs)
50
- return true if argvs['reason'] == 'hostunknown'
46
+ return true if argvs['reason'] == 'hostunknown'
47
+ return false if Sisimai::SMTP::Command::BeforeRCPT.include?(argvs['command'])
51
48
 
52
49
  issuedcode = argvs['diagnosticcode'].downcase || ''
53
50
  statuscode = argvs['deliverystatus'] || ''
@@ -55,7 +52,7 @@ module Sisimai
55
52
  if Sisimai::SMTP::Status.name(statuscode) == 'hostunknown'
56
53
  # To prevent classifying DNS errors as "HostUnknown"
57
54
  require 'sisimai/reason/networkerror'
58
- return true unless Sisimai::Reason::NetworkError.match(issuedcode)
55
+ return true if Sisimai::Reason::NetworkError.match(issuedcode) == false
59
56
  else
60
57
  # Status: 5.1.2
61
58
  # Diagnostic-Code: SMTP; 550 Host unknown