sisimai 4.22.3 → 4.22.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sisimai might be problematic. Click here for more details.

Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/Benchmarks.mk +54 -0
  4. data/ChangeLog.md +23 -2
  5. data/Developers.mk +42 -35
  6. data/Makefile +10 -0
  7. data/README-JA.md +13 -13
  8. data/README.md +14 -14
  9. data/lib/sisimai.rb +12 -18
  10. data/lib/sisimai/address.rb +64 -82
  11. data/lib/sisimai/arf.rb +27 -42
  12. data/lib/sisimai/bite/email.rb +2 -4
  13. data/lib/sisimai/bite/email/activehunter.rb +12 -17
  14. data/lib/sisimai/bite/email/amazonses.rb +30 -48
  15. data/lib/sisimai/bite/email/amazonworkmail.rb +20 -27
  16. data/lib/sisimai/bite/email/aol.rb +27 -35
  17. data/lib/sisimai/bite/email/apachejames.rb +17 -28
  18. data/lib/sisimai/bite/email/bigfoot.rb +20 -33
  19. data/lib/sisimai/bite/email/biglobe.rb +15 -24
  20. data/lib/sisimai/bite/email/courier.rb +37 -61
  21. data/lib/sisimai/bite/email/domino.rb +19 -28
  22. data/lib/sisimai/bite/email/einsundeins.rb +20 -34
  23. data/lib/sisimai/bite/email/exchange2003.rb +25 -43
  24. data/lib/sisimai/bite/email/exchange2007.rb +15 -23
  25. data/lib/sisimai/bite/email/exim.rb +101 -120
  26. data/lib/sisimai/bite/email/ezweb.rb +28 -44
  27. data/lib/sisimai/bite/email/facebook.rb +26 -37
  28. data/lib/sisimai/bite/email/fml.rb +11 -20
  29. data/lib/sisimai/bite/email/gmx.rb +17 -27
  30. data/lib/sisimai/bite/email/google.rb +19 -29
  31. data/lib/sisimai/bite/email/gsuite.rb +39 -48
  32. data/lib/sisimai/bite/email/imailserver.rb +25 -39
  33. data/lib/sisimai/bite/email/interscanmss.rb +19 -26
  34. data/lib/sisimai/bite/email/kddi.rb +20 -33
  35. data/lib/sisimai/bite/email/mailfoundry.rb +14 -24
  36. data/lib/sisimai/bite/email/mailmarshalsmtp.rb +15 -24
  37. data/lib/sisimai/bite/email/mailru.rb +40 -59
  38. data/lib/sisimai/bite/email/mcafee.rb +21 -35
  39. data/lib/sisimai/bite/email/messagelabs.rb +23 -38
  40. data/lib/sisimai/bite/email/messagingserver.rb +15 -27
  41. data/lib/sisimai/bite/email/mfilter.rb +19 -28
  42. data/lib/sisimai/bite/email/mxlogic.rb +31 -49
  43. data/lib/sisimai/bite/email/notes.rb +16 -24
  44. data/lib/sisimai/bite/email/office365.rb +29 -38
  45. data/lib/sisimai/bite/email/opensmtpd.rb +50 -67
  46. data/lib/sisimai/bite/email/outlook.rb +24 -36
  47. data/lib/sisimai/bite/email/postfix.rb +33 -42
  48. data/lib/sisimai/bite/email/qmail.rb +44 -59
  49. data/lib/sisimai/bite/email/receivingses.rb +28 -36
  50. data/lib/sisimai/bite/email/sendgrid.rb +28 -37
  51. data/lib/sisimai/bite/email/sendmail.rb +35 -51
  52. data/lib/sisimai/bite/email/surfcontrol.rb +17 -25
  53. data/lib/sisimai/bite/email/userdefined.rb +17 -28
  54. data/lib/sisimai/bite/email/v5sendmail.rb +32 -41
  55. data/lib/sisimai/bite/email/verizon.rb +31 -56
  56. data/lib/sisimai/bite/email/x1.rb +11 -18
  57. data/lib/sisimai/bite/email/x2.rb +11 -23
  58. data/lib/sisimai/bite/email/x3.rb +10 -19
  59. data/lib/sisimai/bite/email/x4.rb +46 -65
  60. data/lib/sisimai/bite/email/x5.rb +26 -37
  61. data/lib/sisimai/bite/email/yahoo.rb +11 -19
  62. data/lib/sisimai/bite/email/yandex.rb +19 -30
  63. data/lib/sisimai/bite/email/zoho.rb +21 -30
  64. data/lib/sisimai/bite/json.rb +1 -2
  65. data/lib/sisimai/bite/json/amazonses.rb +20 -25
  66. data/lib/sisimai/bite/json/sendgrid.rb +1 -1
  67. data/lib/sisimai/data.rb +36 -55
  68. data/lib/sisimai/data/json.rb +3 -3
  69. data/lib/sisimai/data/yaml.rb +1 -1
  70. data/lib/sisimai/datetime.rb +5 -21
  71. data/lib/sisimai/mail.rb +4 -6
  72. data/lib/sisimai/mail/maildir.rb +1 -1
  73. data/lib/sisimai/mda.rb +41 -44
  74. data/lib/sisimai/message.rb +2 -3
  75. data/lib/sisimai/message/email.rb +42 -52
  76. data/lib/sisimai/message/json.rb +7 -7
  77. data/lib/sisimai/mime.rb +25 -23
  78. data/lib/sisimai/order/email.rb +2 -2
  79. data/lib/sisimai/order/json.rb +2 -7
  80. data/lib/sisimai/reason.rb +41 -46
  81. data/lib/sisimai/reason/blocked.rb +60 -71
  82. data/lib/sisimai/reason/contenterror.rb +4 -8
  83. data/lib/sisimai/reason/delivered.rb +1 -3
  84. data/lib/sisimai/reason/exceedlimit.rb +10 -20
  85. data/lib/sisimai/reason/expired.rb +5 -9
  86. data/lib/sisimai/reason/feedback.rb +1 -3
  87. data/lib/sisimai/reason/filtered.rb +19 -38
  88. data/lib/sisimai/reason/hasmoved.rb +5 -8
  89. data/lib/sisimai/reason/hostunknown.rb +11 -18
  90. data/lib/sisimai/reason/mailboxfull.rb +14 -24
  91. data/lib/sisimai/reason/mailererror.rb +3 -5
  92. data/lib/sisimai/reason/mesgtoobig.rb +15 -25
  93. data/lib/sisimai/reason/networkerror.rb +8 -10
  94. data/lib/sisimai/reason/norelaying.rb +9 -14
  95. data/lib/sisimai/reason/notaccept.rb +9 -21
  96. data/lib/sisimai/reason/onhold.rb +3 -8
  97. data/lib/sisimai/reason/policyviolation.rb +8 -10
  98. data/lib/sisimai/reason/rejected.rb +36 -49
  99. data/lib/sisimai/reason/securityerror.rb +11 -13
  100. data/lib/sisimai/reason/spamdetected.rb +23 -37
  101. data/lib/sisimai/reason/suspend.rb +9 -10
  102. data/lib/sisimai/reason/syntaxerror.rb +3 -4
  103. data/lib/sisimai/reason/systemerror.rb +7 -9
  104. data/lib/sisimai/reason/systemfull.rb +2 -4
  105. data/lib/sisimai/reason/toomanyconn.rb +17 -30
  106. data/lib/sisimai/reason/undefined.rb +1 -3
  107. data/lib/sisimai/reason/userunknown.rb +28 -38
  108. data/lib/sisimai/reason/vacation.rb +4 -6
  109. data/lib/sisimai/reason/virusdetected.rb +4 -6
  110. data/lib/sisimai/rfc2606.rb +1 -2
  111. data/lib/sisimai/rfc3464.rb +87 -101
  112. data/lib/sisimai/rfc3834.rb +29 -39
  113. data/lib/sisimai/rfc5322.rb +17 -24
  114. data/lib/sisimai/rhost.rb +10 -7
  115. data/lib/sisimai/rhost/exchangeonline.rb +124 -255
  116. data/lib/sisimai/rhost/franceptt.rb +2 -2
  117. data/lib/sisimai/rhost/godaddy.rb +12 -25
  118. data/lib/sisimai/rhost/googleapps.rb +82 -183
  119. data/lib/sisimai/smtp.rb +4 -4
  120. data/lib/sisimai/smtp/error.rb +8 -8
  121. data/lib/sisimai/smtp/reply.rb +1 -1
  122. data/lib/sisimai/smtp/status.rb +1 -0
  123. data/lib/sisimai/string.rb +5 -7
  124. data/lib/sisimai/version.rb +1 -1
  125. data/set-of-emails/README.md +1 -1
  126. data/set-of-emails/maildir/bsd/README.md +50 -50
  127. data/sisimai-java.gemspec +1 -1
  128. data/sisimai.gemspec +1 -1
  129. metadata +5 -5
  130. data/lib/sisimai/skeleton.rb +0 -43
@@ -11,9 +11,7 @@ module Sisimai
11
11
  # Imported from p5-Sisimail/lib/Sisimai/Reason/ContentError.pm
12
12
  class << self
13
13
  def text; return 'contenterror'; end
14
- def description
15
- return 'Email rejected due to a header format of the email'
16
- end
14
+ def description; return 'Email rejected due to a header format of the email'; end
17
15
 
18
16
  # Try to match that the given text and regular expressions
19
17
  # @param [String] argv1 String to be matched with regular expressions
@@ -29,12 +27,12 @@ module Sisimai
29
27
  )
30
28
  |routing[ ]loop[ ]detected[ ][-][-][ ]too[ ]many[ ]received:[ ]headers
31
29
  |this[ ]message[ ]contains?[ ](?:
32
- invalid[ ]MIME[ ]headers
30
+ invalid[ ]mime[ ]headers
33
31
  |improperly[-]formatted[ ]binary[ ]content
34
32
  |text[ ]that[ ]uses[ ]unnecessary[ ]base64[ ]encoding
35
33
  )
36
34
  )
37
- }xi
35
+ }x
38
36
 
39
37
  return true if argv1 =~ regex
40
38
  return false
@@ -45,9 +43,7 @@ module Sisimai
45
43
  # @return [True,False] true: rejected due to content error
46
44
  # false: is not content error
47
45
  # @see http://www.ietf.org/rfc/rfc2822.txt
48
- def true(_argvs)
49
- return nil
50
- end
46
+ def true(_argvs); return nil; end
51
47
 
52
48
  end
53
49
  end
@@ -15,9 +15,7 @@ module Sisimai
15
15
  # Imported from p5-Sisimail/lib/Sisimai/Reason/Delivered.pm
16
16
  class << self
17
17
  def text; return 'delivered'; end
18
- def description
19
- return 'Email delivered successfully'
20
- end
18
+ def description; return 'Email delivered successfully'; end
21
19
  def match; return nil; end
22
20
  def true(*); return nil; end
23
21
  end
@@ -10,9 +10,7 @@ module Sisimai
10
10
  # Imported from p5-Sisimail/lib/Sisimai/Reason/ExceedLimit.pm
11
11
  class << self
12
12
  def text; return 'exceedlimit'; end
13
- def description
14
- return 'Email rejected due to an email exceeded the limit'
15
- end
13
+ def description; return 'Email rejected due to an email exceeded the limit'; end
16
14
 
17
15
  # Try to match that the given text and regular expressions
18
16
  # @param [String] argv1 String to be matched with regular expressions
@@ -20,7 +18,7 @@ module Sisimai
20
18
  # true: Matched
21
19
  def match(argv1)
22
20
  return nil unless argv1
23
- regex = %r/message too large/i
21
+ regex = %r/message too large/
24
22
 
25
23
  return true if argv1 =~ regex
26
24
  return false
@@ -35,25 +33,17 @@ module Sisimai
35
33
  return nil unless argvs
36
34
  return nil unless argvs.is_a? Sisimai::Data
37
35
  return nil unless argvs.deliverystatus.size > 0
38
- return true if argvs.reason == Sisimai::Reason::ExceedLimit.text
36
+ return true if argvs.reason == 'exceedlimit'
39
37
 
38
+ # Delivery status code points exceedlimit.
39
+ # Status: 5.2.3
40
+ # Diagnostic-Code: SMTP; 552 5.2.3 Message size exceeds fixed maximum message size
40
41
  require 'sisimai/smtp/status'
41
- diagnostic = argvs.diagnosticcode || ''
42
- statuscode = argvs.deliverystatus
43
- reasontext = Sisimai::Reason::ExceedLimit.text
44
- v = false
45
-
46
- if Sisimai::SMTP::Status.name(statuscode) == reasontext
47
- # Delivery status code points exceedlimit.
48
- # Status: 5.2.3
49
- # Diagnostic-Code: SMTP; 552 5.2.3 Message size exceeds fixed maximum message size
50
- v = true
51
- else
52
- # Check the value of Diagnosic-Code: header with patterns
53
- v = true if Sisimai::Reason::ExceedLimit.match(diagnostic)
54
- end
42
+ return true if Sisimai::SMTP::Status.name(argvs.deliverystatus) == 'exceedlimit'
55
43
 
56
- return v
44
+ # Check the value of Diagnosic-Code: header with patterns
45
+ return true if match(argvs.diagnosticcode.downcase)
46
+ return false
57
47
  end
58
48
 
59
49
  end
@@ -10,9 +10,7 @@ module Sisimai
10
10
  # Imported from p5-Sisimail/lib/Sisimai/Reason/Expired.pm
11
11
  class << self
12
12
  def text; return 'expired'; end
13
- def description
14
- return 'Delivery time has expired due to a connection failure'
15
- end
13
+ def description; return 'Delivery time has expired due to a connection failure'; end
16
14
 
17
15
  # Try to match that the given text and regular expressions
18
16
  # @param [String] argv1 String to be matched with regular expressions
@@ -24,7 +22,7 @@ module Sisimai
24
22
  connection[ ]timed[ ]out
25
23
  |could[ ]not[ ]find[ ]a[ ]gateway[ ]for
26
24
  |delivery[ ]time[ ]expired
27
- |Failed[ ]to[ ]deliver[ ]to[ ]domain[ ].+[ ]after[ ]\d+[ ]tries
25
+ |failed[ ]to[ ]deliver[ ]to[ ]domain[ ].+[ ]after[ ]\d+[ ]tries
28
26
  |giving[ ]up[ ]on
29
27
  |it[ ]has[ ]not[ ]been[ ]collected[ ]after
30
28
  |message[ ](?:
@@ -35,9 +33,9 @@ module Sisimai
35
33
  |server[ ]did[ ]not[ ]respond
36
34
  |this[ ]message[ ]has[ ]been[ ]in[ ]the[ ]queue[ ]too[ ]long
37
35
  |was[ ]not[ ]reachable[ ]within[ ]the[ ]allowed[ ]queue[ ]period
38
- |Your[ ]message[ ]could[ ]not[ ]be[ ]delivered[ ]for[ ]more[ ]than
36
+ |your[ ]message[ ]could[ ]not[ ]be[ ]delivered[ ]for[ ]more[ ]than
39
37
  )
40
- }ix
38
+ }x
41
39
 
42
40
  return true if argv1 =~ regex
43
41
  return false
@@ -48,9 +46,7 @@ module Sisimai
48
46
  # @return [True,False] true: is expired
49
47
  # false: is not expired
50
48
  # @see http://www.ietf.org/rfc/rfc2822.txt
51
- def true(_argvs)
52
- return nil
53
- end
49
+ def true(_argvs); return nil; end
54
50
 
55
51
  end
56
52
  end
@@ -6,9 +6,7 @@ module Sisimai
6
6
  # Imported from p5-Sisimail/lib/Sisimai/Reason/Feedback.pm
7
7
  class << self
8
8
  def text; return 'feedback'; end
9
- def description
10
- return 'Email forwarded to the sender as a complaint message from your mailbox provider'
11
- end
9
+ def description; return 'Email forwarded to the sender as a complaint message from your mailbox provider'; end
12
10
  def match; return nil; end
13
11
  def true(*); return nil; end
14
12
  end
@@ -13,9 +13,7 @@ module Sisimai
13
13
  # Imported from p5-Sisimail/lib/Sisimai/Reason/Filtered.pm
14
14
  class << self
15
15
  def text; return 'filtered'; end
16
- def description
17
- return 'Email rejected due to a header content after SMTP DATA command'
18
- end
16
+ def description; return 'Email rejected due to a header content after SMTP DATA command'; end
19
17
 
20
18
  # Try to match that the given text and regular expressions
21
19
  # @param [String] argv1 String to be matched with regular expressions
@@ -26,15 +24,15 @@ module Sisimai
26
24
  regex = %r{(?>
27
25
  because[ ]the[ ]recipient[ ]is[ ]only[ ]accepting[ ]mail[ ]from[ ]
28
26
  specific[ ]email[ ]addresses # AOL Phoenix
29
- |Bounced[ ]Address # SendGrid|a message to an address has previously been Bounced.
27
+ |bounced[ ]address # SendGrid|a message to an address has previously been Bounced.
30
28
  |due[ ]to[ ]extended[ ]inactivity[ ]new[ ]mail[ ]is[ ]not[ ]currently[ ]
31
29
  being[ ]accepted[ ]for[ ]this[ ]mailbox
32
- |has[ ]restricted[ ]SMS[ ]e-mail # AT&T
30
+ |has[ ]restricted[ ]sms[ ]e-mail # AT&T
33
31
  |http://postmaster[.]facebook[.]com/.+refused[ ]due[ ]to[ ]recipient[ ]preferences # Facebook
34
- |IS[ ]NOT[ ]ACCEPTING[ ]ANY[ ]MAIL
32
+ |is[ ]not[ ]accepting[ ]any[ ]mail
35
33
  |permanent[ ]failure[ ]for[ ]one[ ]or[ ]more[ ]recipients[ ][(].+:blocked[)]
36
- |RESOLVER[.]RST[.]NotAuthorized # Microsoft Exchange
37
- |This[ ]account[ ]is[ ]protected[ ]by
34
+ |resolver[.]rst[.]notauthorized # Microsoft Exchange
35
+ |this[ ]account[ ]is[ ]protected[ ]by
38
36
  |user[ ](?:
39
37
  not[ ]found # Filter on MAIL.RU
40
38
  |reject
@@ -42,8 +40,8 @@ module Sisimai
42
40
  |we[ ]failed[ ]to[ ]deliver[ ]mail[ ]because[ ]the[ ]following[ ]address
43
41
  [ ]recipient[ ]id[ ]refuse[ ]to[ ]receive[ ]mail # Willcom
44
42
  )
45
- |You[ ]have[ ]been[ ]blocked[ ]by[ ]the[ ]recipient
46
- }ix
43
+ |you[ ]have[ ]been[ ]blocked[ ]by[ ]the[ ]recipient
44
+ }x
47
45
 
48
46
  return true if argv1 =~ regex
49
47
  return false
@@ -57,42 +55,26 @@ module Sisimai
57
55
  def true(argvs)
58
56
  return nil unless argvs
59
57
  return nil unless argvs.is_a? Sisimai::Data
60
- return true if argvs.reason == Sisimai::Reason::Filtered.text
58
+ return true if argvs.reason == 'filtered'
61
59
 
62
60
  require 'sisimai/smtp/status'
63
61
  require 'sisimai/reason/userunknown'
64
62
  commandtxt = argvs.smtpcommand || ''
65
- statuscode = argvs.deliverystatus || ''
66
- diagnostic = argvs.diagnosticcode || ''
67
- tempreason = Sisimai::SMTP::Status.name(statuscode)
68
- reasontext = Sisimai::Reason::Filtered.text
69
- v = false
63
+ diagnostic = argvs.diagnosticcode.downcase || ''
64
+ tempreason = Sisimai::SMTP::Status.name(argvs.deliverystatus)
65
+ alterclass = Sisimai::Reason::UserUnknown
70
66
 
71
67
  return false if tempreason == 'suspend'
72
-
73
- if tempreason == reasontext
68
+ if tempreason == 'filtered'
74
69
  # Delivery status code points "filtered".
75
- if Sisimai::Reason::UserUnknown.match(diagnostic) ||
76
- Sisimai::Reason::Filtered.match(diagnostic)
77
- v = true
78
- end
79
- else
80
- # Check the value of Diagnostic-Code and the last SMTP command
81
- if commandtxt != 'RCPT' && commandtxt != 'MAIL'
82
- # Check the last SMTP command of the session.
83
- if Sisimai::Reason::Filtered.match(diagnostic)
84
- # Matched with a pattern in this class
85
- v = true
70
+ return true if alterclass.match(diagnostic) || match(diagnostic)
86
71
 
87
- else
88
- # Did not match with patterns in this class,
89
- # Check the value of "Diagnostic-Code" with other error patterns.
90
- v = true if Sisimai::Reason::UserUnknown.match(diagnostic)
91
- end
92
- end
72
+ elsif commandtxt != 'RCPT' && commandtxt != 'MAIL'
73
+ # Check the value of Diagnostic-Code and the last SMTP command
74
+ return true if match(diagnostic)
75
+ return true if alterclass.match(diagnostic)
93
76
  end
94
-
95
- return v
77
+ return false
96
78
  end
97
79
 
98
80
  end
@@ -100,4 +82,3 @@ module Sisimai
100
82
  end
101
83
  end
102
84
 
103
-
@@ -10,9 +10,7 @@ module Sisimai
10
10
  # Imported from p5-Sisimail/lib/Sisimai/Reason/HasMoved.pm
11
11
  class << self
12
12
  def text; return 'hasmoved'; end
13
- def description
14
- return "Email rejected due to user's mailbox has moved and is not forwarded automatically"
15
- end
13
+ def description; return "Email rejected due to user's mailbox has moved and is not forwarded automatically"; end
16
14
 
17
15
  # Try to match that the given text and regular expressions
18
16
  # @param [String] argv1 String to be matched with regular expressions
@@ -20,7 +18,7 @@ module Sisimai
20
18
  # true: Matched
21
19
  def match(argv1)
22
20
  return nil unless argv1
23
- regex = %r/address[ ].+[ ]has[ ]been[ ]replaced[ ]by[ ]/ix
21
+ regex = %r/address[ ].+ has been replaced by /
24
22
 
25
23
  return true if argv1 =~ regex
26
24
  return false
@@ -34,8 +32,9 @@ module Sisimai
34
32
  def true(argvs)
35
33
  return nil unless argvs
36
34
  return nil unless argvs.is_a? Sisimai::Data
37
- return true if argvs.reason == Sisimai::Reason::HasMoved.text
38
- return true if Sisimai::Reason::HasMoved.match(argvs.diagnosticcode)
35
+
36
+ return true if argvs.reason == 'hasmoved'
37
+ return true if match(argvs.diagnosticcode.downcase)
39
38
  return false
40
39
  end
41
40
 
@@ -44,5 +43,3 @@ module Sisimai
44
43
  end
45
44
  end
46
45
 
47
-
48
-
@@ -9,9 +9,7 @@ module Sisimai
9
9
  # Imported from p5-Sisimail/lib/Sisimai/Reason/HostUnknown.pm
10
10
  class << self
11
11
  def text; return 'hostunknown'; end
12
- def description
13
- return "Delivery failed due to a domain part of a recipient's email address does not exist"
14
- end
12
+ def description; return "Delivery failed due to a domain part of a recipient's email address does not exist"; end
15
13
 
16
14
  # Try to match that the given text and regular expressions
17
15
  # @param [String] argv1 String to be matched with regular expressions
@@ -31,18 +29,18 @@ module Sisimai
31
29
  |unknown
32
30
  |unreachable
33
31
  )
34
- |Mail[ ]domain[ ]mentioned[ ]in[ ]email[ ]address[ ]is[ ]unknown
32
+ |mail[ ]domain[ ]mentioned[ ]in[ ]email[ ]address[ ]is[ ]unknown
35
33
  |name[ ]or[ ]service[ ]not[ ]known
36
34
  |no[ ]such[ ]domain
37
35
  |recipient[ ](?:
38
36
  address[ ]rejected:[ ]unknown[ ]domain[ ]name
39
37
  |domain[ ]must[ ]exist
40
38
  )
41
- |The[ ]account[ ]or[ ]domain[ ]may[ ]not[ ]exist
39
+ |the[ ]account[ ]or[ ]domain[ ]may[ ]not[ ]exist
42
40
  |unknown[ ]host
43
- |Unrouteable[ ]address
41
+ |unrouteable[ ]address
44
42
  )
45
- }ix
43
+ }x
46
44
 
47
45
  return true if argv1 =~ regex
48
46
  return false
@@ -56,26 +54,23 @@ module Sisimai
56
54
  def true(argvs)
57
55
  return nil unless argvs
58
56
  return nil unless argvs.is_a? Sisimai::Data
59
- return true if argvs.reason == Sisimai::Reason::HostUnknown.text
57
+ return true if argvs.reason == 'hostunknown'
60
58
 
61
59
  require 'sisimai/smtp/status'
62
- diagnostic = argvs.diagnosticcode || ''
60
+ diagnostic = argvs.diagnosticcode.downcase || ''
63
61
  statuscode = argvs.deliverystatus || ''
64
- tempreason = Sisimai::SMTP::Status.name(statuscode)
65
- reasontext = Sisimai::Reason::HostUnknown.text
66
- v = false
67
62
 
68
- if tempreason == reasontext
63
+ if Sisimai::SMTP::Status.name(statuscode) == 'hostunknown'
69
64
  # Status: 5.1.2
70
65
  # Diagnostic-Code: SMTP; 550 Host unknown
71
66
  require 'sisimai/reason/networkerror'
72
- v = true unless Sisimai::Reason::NetworkError.match(diagnostic)
67
+ return true unless Sisimai::Reason::NetworkError.match(diagnostic)
73
68
  else
74
69
  # Check the value of Diagnosic-Code: header with patterns
75
- v = true if Sisimai::Reason::HostUnknown.match(diagnostic)
70
+ return true if match(diagnostic)
76
71
  end
77
72
 
78
- return v
73
+ return false
79
74
  end
80
75
 
81
76
  end
@@ -83,5 +78,3 @@ module Sisimai
83
78
  end
84
79
  end
85
80
 
86
-
87
-
@@ -10,9 +10,7 @@ module Sisimai
10
10
  # Imported from p5-Sisimail/lib/Sisimai/Reason/MailboxFull.pm
11
11
  class << self
12
12
  def text; return 'mailboxfull'; end
13
- def description
14
- return "Email rejected due to a recipient's mailbox is full"
15
- end
13
+ def description; return "Email rejected due to a recipient's mailbox is full"; end
16
14
 
17
15
  # Try to match that the given text and regular expressions
18
16
  # @param [String] argv1 String to be matched with regular expressions
@@ -21,13 +19,13 @@ module Sisimai
21
19
  def match(argv1)
22
20
  return nil unless argv1
23
21
  regex = %r{(?>
24
- Account[ ]disabled[ ]temporarly[ ]for[ ]exceeding[ ]receiving[ ]limits
22
+ account[ ]disabled[ ]temporarly[ ]for[ ]exceeding[ ]receiving[ ]limits
25
23
  |account[ ]is[ ](?:
26
24
  exceeding[ ]their[ ]quota
27
25
  |over[ ]quota
28
26
  |temporarily[ ]over[ ]quota
29
27
  )
30
- |Boite[ ]du[ ]destinataire[ ]pleine.+[A-Z]{3}.+417
28
+ |boite[ ]du[ ]destinataire[ ]pleine.+[a-z]{3}.+417
31
29
  |delivery[ ]failed:[ ]over[ ]quota
32
30
  |disc[ ]quota[ ]exceeded
33
31
  |does[ ]not[ ]have[ ]enough[ ]space
@@ -52,7 +50,7 @@ module Sisimai
52
50
  |size[ ]limit[ ]exceeded
53
51
  )
54
52
  |maildir[ ](?:
55
- delivery[ ]failed:[ ](?:User|Domain)disk[ ]quota[ ]?.*[ ]exceeded
53
+ delivery[ ]failed:[ ](?:user|domain)disk[ ]quota[ ]?.*[ ]exceeded
56
54
  |over[ ]quota
57
55
  )
58
56
  |mailfolder[ ]is[ ]full
@@ -66,7 +64,7 @@ module Sisimai
66
64
  reached[ ]disk[ ]quota
67
65
  |rejected:[ ]mailbox[ ]would[ ]exceed[ ]maximum[ ]allowed[ ]storage
68
66
  )
69
- |The[ ](?:
67
+ |the[ ](?:
70
68
  recipient[ ]mailbox[ ]has[ ]exceeded[ ]its[ ]disk[ ]space[ ]limit
71
69
  |user[']s[ ]space[ ]has[ ]been[ ]used[ ]up
72
70
  |user[ ]you[ ]are[ ]trying[ ]to[ ]reach[ ]is[ ]over[ ]quota
@@ -84,7 +82,7 @@ module Sisimai
84
82
  |was[ ]automatically[ ]rejected:[ ]quota[ ]exceeded
85
83
  |would[ ]be[ ]over[ ]the[ ]allowed[ ]quota
86
84
  )
87
- }ix
85
+ }x
88
86
 
89
87
  return true if argv1 =~ regex
90
88
  return false
@@ -99,25 +97,17 @@ module Sisimai
99
97
  return nil unless argvs
100
98
  return nil unless argvs.is_a? Sisimai::Data
101
99
  return nil unless argvs.deliverystatus.size > 0
102
- return true if argvs.reason == Sisimai::Reason::MailboxFull.text
100
+ return true if argvs.reason == 'mailboxfull'
103
101
 
102
+ # Delivery status code points "mailboxfull".
103
+ # Status: 4.2.2
104
+ # Diagnostic-Code: SMTP; 450 4.2.2 <***@example.jp>... Mailbox Full
104
105
  require 'sisimai/smtp/status'
105
- statuscode = argvs.deliverystatus
106
- diagnostic = argvs.diagnosticcode || ''
107
- reasontext = Sisimai::Reason::MailboxFull.text
108
- v = false
109
-
110
- if Sisimai::SMTP::Status.name(statuscode) == reasontext
111
- # Delivery status code points "mailboxfull".
112
- # Status: 4.2.2
113
- # Diagnostic-Code: SMTP; 450 4.2.2 <***@example.jp>... Mailbox Full
114
- v = true
115
- else
116
- # Check the value of Diagnosic-Code: header with patterns
117
- v = true if Sisimai::Reason::MailboxFull.match(diagnostic)
118
- end
106
+ return true if Sisimai::SMTP::Status.name(argvs.deliverystatus) == 'mailboxfull'
119
107
 
120
- return v
108
+ # Check the value of Diagnosic-Code: header with patterns
109
+ return true if match(argvs.diagnosticcode.downcase)
110
+ return false
121
111
  end
122
112
 
123
113
  end