sisimai 5.5.0 → 5.7.0

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 (113) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake-test.yml +0 -4
  3. data/ChangeLog.md +53 -0
  4. data/LICENSE +1 -1
  5. data/README-JA.md +26 -20
  6. data/README.md +30 -25
  7. data/lib/sisimai/address.rb +8 -31
  8. data/lib/sisimai/arf.rb +3 -5
  9. data/lib/sisimai/fact.rb +26 -36
  10. data/lib/sisimai/lhost/activehunter.rb +0 -2
  11. data/lib/sisimai/lhost/amazonses.rb +7 -9
  12. data/lib/sisimai/lhost/apachejames.rb +0 -1
  13. data/lib/sisimai/lhost/biglobe.rb +0 -16
  14. data/lib/sisimai/lhost/courier.rb +5 -4
  15. data/lib/sisimai/lhost/deutschetelekom.rb +120 -0
  16. data/lib/sisimai/lhost/domino.rb +0 -3
  17. data/lib/sisimai/lhost/dragonfly.rb +0 -27
  18. data/lib/sisimai/lhost/einsundeins.rb +1 -10
  19. data/lib/sisimai/lhost/exchange2003.rb +4 -4
  20. data/lib/sisimai/lhost/exchange2007.rb +5 -6
  21. data/lib/sisimai/lhost/exim.rb +35 -85
  22. data/lib/sisimai/lhost/ezweb.rb +12 -49
  23. data/lib/sisimai/lhost/fml.rb +4 -29
  24. data/lib/sisimai/lhost/gmail.rb +0 -23
  25. data/lib/sisimai/lhost/gmx.rb +7 -24
  26. data/lib/sisimai/lhost/googlegroups.rb +3 -3
  27. data/lib/sisimai/lhost/googleworkspace.rb +0 -4
  28. data/lib/sisimai/lhost/imailserver.rb +3 -9
  29. data/lib/sisimai/lhost/kddi.rb +6 -20
  30. data/lib/sisimai/lhost/mailfoundry.rb +0 -2
  31. data/lib/sisimai/lhost/mailmarshal.rb +1 -3
  32. data/lib/sisimai/lhost/messagingserver.rb +4 -15
  33. data/lib/sisimai/lhost/mfilter.rb +0 -1
  34. data/lib/sisimai/lhost/mimecast.rb +0 -1
  35. data/lib/sisimai/lhost/notes.rb +1 -2
  36. data/lib/sisimai/lhost/opensmtpd.rb +0 -40
  37. data/lib/sisimai/lhost/postfix.rb +10 -11
  38. data/lib/sisimai/lhost/qmail.rb +14 -81
  39. data/lib/sisimai/lhost/sendmail.rb +4 -4
  40. data/lib/sisimai/lhost/trendmicro.rb +3 -3
  41. data/lib/sisimai/lhost/v5sendmail.rb +0 -1
  42. data/lib/sisimai/lhost/verizon.rb +1 -2
  43. data/lib/sisimai/lhost/x1.rb +1 -2
  44. data/lib/sisimai/lhost/x2.rb +0 -2
  45. data/lib/sisimai/lhost/x3.rb +4 -9
  46. data/lib/sisimai/lhost/x6.rb +0 -1
  47. data/lib/sisimai/lhost/zoho.rb +0 -12
  48. data/lib/sisimai/lhost.rb +38 -19
  49. data/lib/sisimai/message.rb +3 -1
  50. data/lib/sisimai/order.rb +4 -1
  51. data/lib/sisimai/reason/authfailure.rb +9 -13
  52. data/lib/sisimai/reason/badreputation.rb +7 -7
  53. data/lib/sisimai/reason/blocked.rb +57 -83
  54. data/lib/sisimai/reason/contenterror.rb +16 -8
  55. data/lib/sisimai/reason/{mesgtoobig.rb → emailtoolarge.rb} +22 -25
  56. data/lib/sisimai/reason/expired.rb +27 -23
  57. data/lib/sisimai/reason/filtered.rb +13 -17
  58. data/lib/sisimai/reason/hasmoved.rb +2 -1
  59. data/lib/sisimai/reason/hostunknown.rb +25 -19
  60. data/lib/sisimai/reason/mailboxfull.rb +28 -49
  61. data/lib/sisimai/reason/networkerror.rb +28 -16
  62. data/lib/sisimai/reason/norelaying.rb +21 -20
  63. data/lib/sisimai/reason/notaccept.rb +13 -8
  64. data/lib/sisimai/reason/notcompliantrfc.rb +6 -9
  65. data/lib/sisimai/reason/policyviolation.rb +17 -26
  66. data/lib/sisimai/reason/ratelimited.rb +62 -0
  67. data/lib/sisimai/reason/rejected.rb +51 -59
  68. data/lib/sisimai/reason/requireptr.rb +13 -25
  69. data/lib/sisimai/reason/securityerror.rb +14 -19
  70. data/lib/sisimai/reason/spamdetected.rb +51 -101
  71. data/lib/sisimai/reason/suspend.rb +30 -24
  72. data/lib/sisimai/reason/syntaxerror.rb +1 -8
  73. data/lib/sisimai/reason/systemerror.rb +37 -23
  74. data/lib/sisimai/reason/systemfull.rb +1 -1
  75. data/lib/sisimai/reason/userunknown.rb +81 -112
  76. data/lib/sisimai/reason/virusdetected.rb +6 -8
  77. data/lib/sisimai/reason.rb +15 -15
  78. data/lib/sisimai/rfc1123.rb +1 -1
  79. data/lib/sisimai/rfc1894.rb +7 -6
  80. data/lib/sisimai/rfc2045.rb +2 -2
  81. data/lib/sisimai/rfc3464/thirdparty.rb +1 -1
  82. data/lib/sisimai/rfc3464.rb +10 -14
  83. data/lib/sisimai/rfc3834.rb +3 -4
  84. data/lib/sisimai/rfc791.rb +3 -38
  85. data/lib/sisimai/rhost/apple.rb +5 -5
  86. data/lib/sisimai/rhost/cloudflare.rb +2 -0
  87. data/lib/sisimai/rhost/cox.rb +22 -20
  88. data/lib/sisimai/rhost/facebook.rb +16 -16
  89. data/lib/sisimai/rhost/franceptt.rb +8 -3
  90. data/lib/sisimai/rhost/godaddy.rb +33 -15
  91. data/lib/sisimai/rhost/google.rb +63 -64
  92. data/lib/sisimai/rhost/iua.rb +1 -1
  93. data/lib/sisimai/rhost/messagelabs.rb +12 -12
  94. data/lib/sisimai/rhost/microsoft.rb +86 -86
  95. data/lib/sisimai/rhost/mimecast.rb +34 -34
  96. data/lib/sisimai/rhost/nttdocomo.rb +2 -2
  97. data/lib/sisimai/rhost/spectrum.rb +7 -7
  98. data/lib/sisimai/rhost/tencent.rb +9 -11
  99. data/lib/sisimai/rhost/yahooinc.rb +7 -8
  100. data/lib/sisimai/rhost.rb +1 -1
  101. data/lib/sisimai/smtp/command.rb +2 -0
  102. data/lib/sisimai/smtp/status.rb +73 -109
  103. data/lib/sisimai/string.rb +0 -27
  104. data/lib/sisimai/version.rb +1 -1
  105. data/set-of-emails/maildir/bsd/lhost-deutschetelekom-01.eml +66 -0
  106. data/set-of-emails/maildir/bsd/lhost-deutschetelekom-02.eml +68 -0
  107. data/set-of-emails/maildir/bsd/lhost-deutschetelekom-03.eml +50 -0
  108. data/set-of-emails/should-not-crash/p5-664-iomart-mail-filter.eml +258 -0
  109. data/set-of-emails/to-be-debugged-because/sisimai-cannot-parse-yet/.gitkeep +0 -0
  110. metadata +10 -6
  111. data/lib/sisimai/reason/exceedlimit.rb +0 -47
  112. data/lib/sisimai/reason/speeding.rb +0 -47
  113. data/lib/sisimai/reason/toomanyconn.rb +0 -59
@@ -7,93 +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
- 'mailfrom domain is listed in spamhaus',
45
- 'no access from mail server',
46
- 'no matches to nameserver query',
47
- 'not currently accepting mail from your ip', # Microsoft
48
- 'part of their network is on our block list',
49
- 'please use the smtp server of your isp',
50
- 'refused - see http',
51
- 'rejected - multi-blacklist', # junkemailfilter.com
52
- 'rejected because the sending mta or the sender has not passed validation',
53
- 'rejecting open proxy', # Sendmail(srvrsmtp.c)
54
- 'sender ip address rejected',
55
- 'server access forbidden by your ip ',
56
- 'service not available, closing transmission channel',
57
- 'smtp error from remote mail server after initial connection:', # Exim
58
- "sorry, that domain isn't in my list of allowed rcpthosts",
59
- 'sorry, your remotehost looks suspiciously like spammer',
60
- 'temporarily deferred due to unexpected volume or user complaints',
61
- 'to submit messages to this e-mail system has been rejected',
62
- 'too many spams from your ip', # free.fr
63
- 'too many unwanted messages have been sent from the following ip address above',
64
- 'was blocked by ',
65
- 'we do not accept mail from dynamic ips', # @mail.ru
66
- 'you are not allowed to connect',
67
- 'you are sending spam',
68
- 'your ip address is listed in the rbl',
69
- 'your network is temporary blacklisted',
70
- '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",
71
43
  ].freeze
72
44
  Pairs = [
73
- ['(', '@', ':blocked)'],
74
- ['access from ip address ', ' blocked'],
75
- ['client host ', ' blocked using'],
76
- ['connections will not be accepted from ', " because the ip is in spamhaus's list"],
77
- ['dnsbl:rbl ', '>_is_blocked'],
78
- ['email blocked by ', '.barracudacentral.org'],
79
- ['email blocked by ', 'spamhaus'],
80
- ['host ', ' refused to talk to me: ', ' blocked'],
81
- ['ip ', ' is blocked by earthlink'], # Earthlink
82
- ['is in an ', 'rbl on '],
83
- ['mail server at ', ' is blocked'],
84
- ['mail from ',' refused:'],
85
- ["mail from "," refused, see ", "orbs"],
86
- ['message from ', ' rejected based on blacklist'],
87
- ['messages from ', ' temporarily deferred due to user complaints'], # Yahoo!
88
- ['server ip ', ' listed as abusive'],
89
- ['sorry! your ip address', ' is blocked by rbl'], # junkemailfilter.com
90
- ['the domain ', ' is blacklisted'],
91
- ['the email ', ' is blacklisted'],
92
- ['the ip', ' is blacklisted'],
93
- ['veuillez essayer plus tard. service refused, please try later. ', '103'],
94
- ['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"],
95
69
  ["your access ip", " has been rejected"],
96
- ["your sender's ip address is listed at ", '.abuseat.org'],
70
+ ["your sender's ip address is listed at ", ".abuseat.org"],
97
71
  ].freeze
98
72
 
99
73
  def text; return 'blocked'; end
@@ -9,14 +9,22 @@ module Sisimai
9
9
  module ContentError
10
10
  class << self
11
11
  Index = [
12
- 'header size exceeds maximum permitted',
13
- 'improper use of 8-bit data in message header',
14
- 'message header size, or recipient list, exceeds policy limit',
15
- 'message mime complexity exceeds the policy maximum',
16
- 'routing loop detected -- too many received: headers',
17
- 'this message contain invalid mime headers',
18
- 'this message contain improperly-formatted binary content',
19
- 'this message contain text that uses unnecessary base64 encoding',
12
+ "charset not supported",
13
+ "executable files are not allowed in compressed files",
14
+ "header error",
15
+ "header size exceeds maximum permitted",
16
+ "illegal attachment on your message",
17
+ "improper use of 8-bit data in message header",
18
+ "it has a potentially executable attachment",
19
+ "message contain invalid mime headers",
20
+ "message contain improperly-formatted binary content",
21
+ "message contain text that uses unnecessary base64 encoding",
22
+ "message header size, or recipient list, exceeds policy limit",
23
+ "message mime complexity exceeds the policy maximum",
24
+ "message was blocked because its content presents a potential", # https://support.google.com/mail/answer/6590
25
+ "routing loop detected -- too many received: headers",
26
+ 'too many "received" headers', # Exim/deliver.c:5425
27
+ "we do not accept messages containing images or other attachments",
20
28
  ].freeze
21
29
 
22
30
  def text; return 'contenterror'; end
@@ -2,27 +2,25 @@ 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
+ "exceeds the maximum size ",
11
+ "line limit exceeded",
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
@@ -31,6 +29,7 @@ module Sisimai
31
29
  def match(argv1)
32
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,36 @@ 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
+ "delay reason: ", # Exim/deliver.c:7459
14
+ "delivery attempts will continue to be",
15
+ "envelope expired", # OpenSMTPD/smtpd/queue.c:221
16
+ "failed to deliver to domain ",
17
+ "frozen on arrival", # Exim/receive.c:4022
18
+ "has been delayed",
19
+ "has been frozen", # Exim/deliver.c:7586
20
+ "have been failing for a long time", # Exim/smtp.c:3508
21
+ "host not reachable",
22
+ "it has not been collected after",
23
+ "message could not be delivered for more than",
24
+ "message expired, ",
25
+ "message has been in the queue too long",
26
+ "message was not delivered within ",
27
+ "message timed out",
28
+ "retry timeout exceeded", # Exim/retry.c:902
29
+ "server did not accept our requests to connect",
30
+ "server did not respond",
31
+ "unable to deliver message after multiple retries",
33
32
  ].freeze
34
33
  Pairs = [
35
- ['could not be delivered for', ' days'],
34
+ ["could not be delivered for", " days"],
35
+ ["could not deliver for the last", "second"],
36
+ ["delivery ", "expired"],
37
+ ["delivery ", "delayed"],
38
+ ["exceed", "time", "out"],
39
+ ["not", "reach", "period"], # Exim/smtp.c:3508
36
40
  ].freeze
37
41
 
38
42
  def text; return 'expired'; 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
@@ -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
@@ -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,31 @@ 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
+ "all host address lookups failed", # Exim/transports/smtp.c:3524
11
+ "couldn't find any host ", # qmail-remote.c:78
12
+ "dns server returned answer with no data",
13
+ "domain is not reachable",
14
+ "domain mentioned in email address is unknown",
15
+ "domain must exist",
16
+ "domain name not found",
17
+ "host or domain name not found",
18
+ "host unknown",
19
+ "host unreachable",
20
+ "illegal host/domain name found",
21
+ "invalid domain name", # OpenSMTPD/smtpd/mta.c:976
22
+ "mx records point to non-existent hosts", # Exim/routers/dnslookup.c:331
23
+ "name or service not known",
24
+ "no such domain",
25
+ "recipient address rejected: unknown domain name",
26
+ "responded with code nxdomain",
27
+ "unknown host",
28
+ ].freeze
29
+ Pairs = [
30
+ ["domain ", "not exist"],
31
+ ["host ", " not found"],
32
+ ["unrout", "able ", "address"],
27
33
  ].freeze
28
- Pairs = [['553 ', ' does not exist']].freeze
29
34
 
30
35
  def text; return 'hostunknown'; end
31
36
  def description; return "Delivery failed due to a domain part of a recipient's email address does not exist"; end
@@ -47,7 +52,8 @@ module Sisimai
47
52
  # false: is not unknown host.
48
53
  # @see http://www.ietf.org/rfc/rfc2822.txt
49
54
  def true(argvs)
50
- return true if argvs['reason'] == 'hostunknown'
55
+ return true if argvs['reason'] == 'hostunknown'
56
+ return false if Sisimai::SMTP::Command::BeforeRCPT.include?(argvs['command'])
51
57
 
52
58
  issuedcode = argvs['diagnosticcode'].downcase || ''
53
59
  statuscode = argvs['deliverystatus'] || ''
@@ -8,55 +8,33 @@ 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 exceeds allowed size",
17
+ "mailbox size limit exceeded",
18
+ "mailbox would exceed maximum allowed storage",
19
+ "mailfolder is full",
20
+ "no space left on device",
21
+ "not sufficient disk space",
22
+ "quota violation for",
23
+ "too much mail data", # @docomo.ne.jp
24
+ "user has exceeded quota, bouncing mail",
25
+ "user has too many messages on the server",
26
+ "user's space has been used up",
27
+ ].freeze
28
+ Pairs = [
29
+ ["account is ", " quota"],
30
+ ["disk", "quota"],
31
+ ["enough ", " space"],
32
+ ["mailbox ", "exceeded", " limit"],
33
+ ["mailbox ", "full"], # Exim/transports/appendfile.c:2567
34
+ ["mailbox ", "quota"],
35
+ ["maildir ", "quota"],
36
+ ["over ", "quota"],
37
+ ["quota ", "exceeded"], # Exim/transports/appendfile.c:3050
60
38
  ].freeze
61
39
 
62
40
  def text; return 'mailboxfull'; end
@@ -68,6 +46,7 @@ module Sisimai
68
46
  def match(argv1)
69
47
  return false if argv1.nil? || argv1.empty?
70
48
  return true if Index.any? { |a| argv1.include?(a) }
49
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
71
50
  return false
72
51
  end
73
52
 
@@ -11,22 +11,33 @@ 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
+ "address family mismatch on destination mxs", # OpenSMTPD/smtpd/mta.c
15
+ "all routes to destination blocked", # OpenSMTPD/smtpd/mta.c
16
+ "bad dns lookup error code", # OpenSMTPD/smtpd/mta.c
17
+ "could not connect and send the mail to",
18
+ "could not contact dns servers",
19
+ "could not retrieve source address", # OpenSMTPD/smtpd/mta.c
20
+ "dns records for the destination computer could not be found",
21
+ "establish an smtp connection",
22
+ "exceeded maximum hop count", # Courier
23
+ "host is unreachable",
24
+ "host name lookup failure",
25
+ "host not found, try again",
26
+ "listed as a best-preference mx",
27
+ "loop detected", # OpenSMTPD/smtpd/mta.c
28
+ "maximum forwarding loop count exceeded",
29
+ "network error on destination mxs", # OpenSMTPD/smtpd/mta.c
30
+ "no relevant answers",
31
+ "temporary failure in mx lookup", # OpenSMTPD/smtpd/mta.c
32
+ "too many hops",
33
+ "unable to resolve route ",
34
+ "unrouteable mail domain",
35
+ ].freeze
36
+ Pairs = [
37
+ ["malformed", "name server reply"],
38
+ ["mail ", "loop"],
39
+ ["message ", "loop"],
40
+ ["no ", "route to"],
30
41
  ].freeze
31
42
 
32
43
  def text; return 'networkerror'; end
@@ -38,6 +49,7 @@ module Sisimai
38
49
  def match(argv1)
39
50
  return false if argv1.nil? || argv1.empty?
40
51
  return true if Index.any? { |a| argv1.include?(a) }
52
+ return true if Pairs.any? { |a| Sisimai::String.aligned(argv1, a) }
41
53
  return false
42
54
  end
43
55