sisimai 4.25.4 → 4.25.5

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 (100) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -2
  3. data/ChangeLog.md +50 -0
  4. data/README-JA.md +10 -37
  5. data/README.md +10 -37
  6. data/lib/sisimai.rb +15 -64
  7. data/lib/sisimai/address.rb +13 -17
  8. data/lib/sisimai/arf.rb +4 -4
  9. data/lib/sisimai/data.rb +3 -5
  10. data/lib/sisimai/lhost.rb +0 -14
  11. data/lib/sisimai/lhost/activehunter.rb +31 -55
  12. data/lib/sisimai/lhost/amavis.rb +41 -66
  13. data/lib/sisimai/lhost/amazonses.rb +189 -235
  14. data/lib/sisimai/lhost/amazonworkmail.rb +48 -71
  15. data/lib/sisimai/lhost/aol.rb +49 -75
  16. data/lib/sisimai/lhost/apachejames.rb +60 -83
  17. data/lib/sisimai/lhost/bigfoot.rb +61 -85
  18. data/lib/sisimai/lhost/biglobe.rb +40 -62
  19. data/lib/sisimai/lhost/courier.rb +60 -82
  20. data/lib/sisimai/lhost/domino.rb +50 -76
  21. data/lib/sisimai/lhost/einsundeins.rb +57 -55
  22. data/lib/sisimai/lhost/exchange2003.rb +79 -101
  23. data/lib/sisimai/lhost/exchange2007.rb +66 -74
  24. data/lib/sisimai/lhost/exim.rb +119 -142
  25. data/lib/sisimai/lhost/ezweb.rb +53 -73
  26. data/lib/sisimai/lhost/facebook.rb +49 -75
  27. data/lib/sisimai/lhost/fml.rb +25 -50
  28. data/lib/sisimai/lhost/gmx.rb +55 -79
  29. data/lib/sisimai/lhost/google.rb +39 -66
  30. data/lib/sisimai/lhost/gsuite.rb +74 -94
  31. data/lib/sisimai/lhost/imailserver.rb +34 -67
  32. data/lib/sisimai/lhost/interscanmss.rb +33 -67
  33. data/lib/sisimai/lhost/kddi.rb +30 -52
  34. data/lib/sisimai/lhost/mailfoundry.rb +35 -57
  35. data/lib/sisimai/lhost/mailmarshalsmtp.rb +66 -89
  36. data/lib/sisimai/lhost/mailru.rb +51 -76
  37. data/lib/sisimai/lhost/mcafee.rb +53 -79
  38. data/lib/sisimai/lhost/messagelabs.rb +49 -75
  39. data/lib/sisimai/lhost/messagingserver.rb +91 -113
  40. data/lib/sisimai/lhost/mfilter.rb +50 -70
  41. data/lib/sisimai/lhost/mxlogic.rb +38 -63
  42. data/lib/sisimai/lhost/notes.rb +53 -82
  43. data/lib/sisimai/lhost/office365.rb +64 -81
  44. data/lib/sisimai/lhost/opensmtpd.rb +30 -52
  45. data/lib/sisimai/lhost/outlook.rb +49 -75
  46. data/lib/sisimai/lhost/postfix.rb +116 -117
  47. data/lib/sisimai/lhost/qmail.rb +33 -55
  48. data/lib/sisimai/lhost/receivingses.rb +49 -75
  49. data/lib/sisimai/lhost/sendgrid.rb +68 -203
  50. data/lib/sisimai/lhost/sendmail.rb +101 -125
  51. data/lib/sisimai/lhost/surfcontrol.rb +53 -79
  52. data/lib/sisimai/lhost/userdefined.rb +15 -35
  53. data/lib/sisimai/lhost/v5sendmail.rb +59 -89
  54. data/lib/sisimai/lhost/verizon.rb +75 -124
  55. data/lib/sisimai/lhost/x1.rb +30 -54
  56. data/lib/sisimai/lhost/x2.rb +28 -52
  57. data/lib/sisimai/lhost/x3.rb +44 -68
  58. data/lib/sisimai/lhost/x4.rb +34 -58
  59. data/lib/sisimai/lhost/x5.rb +42 -70
  60. data/lib/sisimai/lhost/yahoo.rb +44 -68
  61. data/lib/sisimai/lhost/yandex.rb +59 -85
  62. data/lib/sisimai/lhost/zoho.rb +54 -78
  63. data/lib/sisimai/mail.rb +5 -9
  64. data/lib/sisimai/mail/maildir.rb +10 -14
  65. data/lib/sisimai/mail/mbox.rb +8 -12
  66. data/lib/sisimai/mail/memory.rb +5 -9
  67. data/lib/sisimai/mail/stdin.rb +7 -11
  68. data/lib/sisimai/mda.rb +2 -2
  69. data/lib/sisimai/message.rb +51 -154
  70. data/lib/sisimai/mime.rb +2 -2
  71. data/lib/sisimai/order.rb +2 -27
  72. data/lib/sisimai/reason.rb +3 -5
  73. data/lib/sisimai/rfc1894.rb +1 -1
  74. data/lib/sisimai/rfc3464.rb +29 -29
  75. data/lib/sisimai/rfc3834.rb +7 -6
  76. data/lib/sisimai/rfc5322.rb +20 -31
  77. data/lib/sisimai/rhost/franceptt.rb +120 -24
  78. data/lib/sisimai/rhost/iua.rb +1 -1
  79. data/lib/sisimai/smtp/error.rb +7 -7
  80. data/lib/sisimai/version.rb +1 -1
  81. data/set-of-emails/maildir/bsd/email-einsundeins-03.eml +66 -0
  82. data/set-of-emails/maildir/bsd/email-exchange2007-05.eml +1469 -0
  83. data/set-of-emails/maildir/bsd/email-exchange2007-06.eml +764 -0
  84. data/set-of-emails/maildir/bsd/email-postfix-64.eml +96 -0
  85. data/set-of-emails/maildir/bsd/rfc3834-03.eml +26 -0
  86. data/set-of-emails/maildir/bsd/rhost-franceptt-04.eml +66 -0
  87. data/set-of-emails/maildir/bsd/rhost-franceptt-05.eml +96 -0
  88. data/set-of-emails/maildir/bsd/rhost-franceptt-06.eml +100 -0
  89. data/set-of-emails/maildir/bsd/rhost-franceptt-07.eml +97 -0
  90. data/set-of-emails/maildir/bsd/rhost-franceptt-08.eml +78 -0
  91. data/set-of-emails/maildir/bsd/rhost-franceptt-10.eml +79 -0
  92. data/set-of-emails/maildir/bsd/rhost-franceptt-11.eml +96 -0
  93. metadata +14 -9
  94. data/lib/sisimai/bite.rb +0 -42
  95. data/lib/sisimai/bite/email.rb +0 -18
  96. data/lib/sisimai/bite/json.rb +0 -16
  97. data/lib/sisimai/message/email.rb +0 -26
  98. data/lib/sisimai/message/json.rb +0 -24
  99. data/lib/sisimai/order/email.rb +0 -20
  100. data/lib/sisimai/order/json.rb +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ae7efed62436e79f66169f4330363ee5a29da001d3c27116d482691c52b41a6
4
- data.tar.gz: acabb1f0447f1f077bafb00bff61184e124fe6dffc0c3333f1cb192e8c7eaf9f
3
+ metadata.gz: bf50fe472bdf358908619b5571800aa29c181ed59c11bcc52718c504f54ec991
4
+ data.tar.gz: d764cfda21b0b8c49e53f50b5ddd7527665e8c9721a5c4a1bebb8e9dc9eac2a6
5
5
  SHA512:
6
- metadata.gz: 8ec06a3be887143a9d0d0cdd33ae5616003127ec4f2d9d49cfdc85d201f858f4bf43f1ef18be267ee36f39d6974dde414a884d78b200d81f5d9fcfbb3cfb678b
7
- data.tar.gz: 98f96ff3685f168e7f3012ba157421d2a79fc1e35adc46da9f69eb0061717fba2bd171b7eca301b5c182746486b3bedd6c2346af0dbe66fc55fd6d86e95e8dde
6
+ metadata.gz: ce283bb17ad9beb4a82186e653a67c92e6357652db7148c30ad69ae5ab9d6734a49a5c88b0ac2c6302cb13274350644ca4651fafa3aa5eaf96edc0a49c73a849
7
+ data.tar.gz: 9cbd0b351b7166af32183255e492cd4490017a037443e867bc63d6ca13939d7d5cc123b903464c711628bb4497a14d86de027e547abe55aed788e78286b85367
@@ -3,8 +3,8 @@ rvm:
3
3
  # See http://rubies.travis-ci.org for Precompiled Ruby Versions
4
4
  - 2.1.1
5
5
  - 2.2.4
6
- - 2.3.0
7
- - 2.4.0
6
+ # - 2.3.0
7
+ # - 2.4.0
8
8
  # - 2.5.0
9
9
  - 2.6.0
10
10
  # - jruby-9.0.5.0
@@ -3,6 +3,56 @@ RELEASE NOTES for Ruby version of Sisimai
3
3
  - releases: "https://github.com/sisimai/rb-Sisimai/releases"
4
4
  - download: "https://rubygems.org/gems/sisimai"
5
5
 
6
+ v4.25.5
7
+ --------------------------------------------------------------------------------
8
+ - release: "Wed, 22 Jan 2020 14:44:44 +0900 (JST)"
9
+ - version: "4.25.5"
10
+ - changes:
11
+ - **JSON READING AS A INPUT SOURCE AND JSON PARSING AS A BOUNCE OBJECT ARE NO
12
+ LONGER PROVIDED AS OF v4.25.5**
13
+ - The following obsoleted classes and modules have been removed #166 #168
14
+ - `Sisimai::Message::Email`
15
+ - `Sisimai::Message::JSON`
16
+ - `Sisimai::Order::Email`
17
+ - `Sisimai::Order::JSON`
18
+ - `Sisimai::Bite::Email`
19
+ - `Sisimai::Bite::JSON`
20
+ - Fix bug in code to detect whether a bounce mail was generated by Office365
21
+ or not at `Sisimai::Lhost::Office365`
22
+ - Import sisimai/p5-Sisimai#342
23
+ - Fix parser code to get an error message which is not beginning with `#`
24
+ character at Exchange2007.
25
+ - Import sisimai/p5-Sisimai#347
26
+ - Support case insensitive error code at `Sisimai::Rhost::FrancePTT`,
27
+ - Import sisimai/p5-Sisimai#348
28
+ - Code improvements at `Sisimai::Lhost::EinsUndEins` for detecting errors
29
+ and setting the value of `rhost`
30
+ - Many Pull-Requests and sample emails for French ESPs by @aderumier
31
+ - Add 4 error code values at `Sisimai::Rhost::FrancePTT`
32
+ - `102` = `blocked`
33
+ - `426` = `suspend`
34
+ - `505` = `systemerror`
35
+ - `999` = `blocked`
36
+ - Add 7 sample emails at set-of-emails/ directory: rhost-franceptt-04, 05,
37
+ 06, 07, 08, 10, and 11 for `Sisimai::Rhost::FrancePTT` #353 #357
38
+ - Add many error codes and error messages from Orange and La Poste
39
+ - Import sisimai/p5-Sisimai#350
40
+ - Code improvement at `Sisimai::Lhost::Postfix` for setting `HELO` into the
41
+ value of `smtpcommand` in the parsed results.
42
+ - Import sisimai/p5-Sisimai#351
43
+ - Code improvements at `Sisimai::Lhost::Postfix` for parsing an email which
44
+ have neither delivery reports nor error messages.
45
+ - Import sisimai/p5-Sisimai#352
46
+ - Code improvements at `Sisimai::RFC3834` for parsing a vacation message
47
+ replied automatically from iCloud.
48
+ - Accessor improvements in the following classes:
49
+ - `Sisimai::Message`
50
+ - `Sisimai::Data`
51
+ - `Sisimai::Mail` and child classes in `sisimai/mail` directory
52
+ - Fix duplicated ranges in some regular expressions at `Sisimai::Address`
53
+ - Large scale code improvement at each modules in `Sisimai::Lhost`
54
+ - reduce the number of lines in code about 12%
55
+
6
56
  v4.25.4
7
57
  --------------------------------------------------------------------------------
8
58
  - release: "Tue, 3 Dec 2019 12:34:45 +0900 (JST)"
@@ -19,7 +19,6 @@
19
19
  - [使い方 | Usage](#usage)
20
20
  - [基本的な使い方 | Basic usage](#basic-usage)
21
21
  - [解析結果をJSONで得る | Convert to JSON](#convert-to-json)
22
- - [バウンスオブジェクトを読む | Read bounce object](#read-bounce-object)
23
22
  - [コールバック機能 | Callback feature](#callback-feature)
24
23
  - [ワンライナー | One-Liner](#one-liner)
25
24
  - [出力例 | Output example](#output-example)
@@ -56,8 +55,6 @@ Key features
56
55
  * 解析精度はbounceHammerの2倍
57
56
  * 29種類のMTAに対応
58
57
  * 22種類の著名なMSPに対応
59
- * 2種類の著名なメール配信クラウドに対応(JSON)
60
- * **Sisimai 4.25.5で削除予定**
61
58
  * Feedback Loopにも対応
62
59
  * 29種類のエラー理由を検出
63
60
 
@@ -81,10 +78,10 @@ Install
81
78
 
82
79
  ```shell
83
80
  $ sudo gem install sisimai
84
- Fetching: sisimai-4.25.2.gem (100%)
85
- Successfully installed sisimai-4.25.2
86
- Parsing documentation for sisimai-4.25.2
87
- Installing ri documentation for sisimai-4.25.2
81
+ Fetching: sisimai-4.25.5.gem (100%)
82
+ Successfully installed sisimai-4.25.5
83
+ Parsing documentation for sisimai-4.25.5
84
+ Installing ri documentation for sisimai-4.25.5
88
85
  Done installing documentation for sisimai after 6 seconds
89
86
  1 gem installed
90
87
  ```
@@ -100,8 +97,8 @@ gem install bundle rake rspec coveralls
100
97
  ...
101
98
  4 gems installed
102
99
  bundle exec rake install
103
- sisimai 4.25.2 built to pkg/sisimai-4.25.2.gem.
104
- sisimai (4.25.2) installed.
100
+ sisimai 4.25.5 built to pkg/sisimai-4.25.5.gem.
101
+ sisimai (4.25.5) installed.
105
102
  ```
106
103
 
107
104
  Usage
@@ -159,30 +156,6 @@ puts Sisimai.dump('/path/to/mbox') # or path to Maildir/
159
156
  puts Sisimai.dump('/path/to/mbox', delivered: true)
160
157
  ```
161
158
 
162
- Read bounce object
163
- -------------------------------------------------------------------------------
164
- **この機能はSisimai 4.25.5で削除されます**
165
-
166
- メール配信クラウドからAPIで取得したバウンスオブジェクト(JSON)を読んで解析する
167
- 場合は、次のようなコードを書いてください。この機能はSisimai v4.20.0で実装され
168
- ました。
169
-
170
- ```ruby
171
- #! /usr/bin/env ruby
172
- require 'json'
173
- require 'sisimai'
174
-
175
- j = JSON.load('{"notificationType"=>"Bounce", "bounce"=>{"...') # JSON String
176
- v = Sisimai.make(j, input: 'json')
177
-
178
- if v.is_a? Array
179
- v.each do |e|
180
- ...
181
- end
182
- end
183
- ```
184
- 現時点ではAmazon SESとSendGridのみをサポートしています。
185
-
186
159
  Callback feature
187
160
  -------------------------------------------------------------------------------
188
161
  Sisimai 4.19.0から`Sisimai.make()`と`Sisimai.dump()`にLamda(Procオブジェクト)
@@ -244,11 +217,11 @@ Differences between Ruby version and Perl version
244
217
  | 動作環境 | Ruby 2.1 - 2.6 | Perl 5.10 - |
245
218
  | | JRuby 9.0.4.0- | |
246
219
  | 解析精度の割合(2000通のメール)[1] | 1.00 | 1.00 |
247
- | メール解析速度(1000通のメール) | 2.22秒[2] | 1.50秒 |
220
+ | メール解析速度(1000通のメール) | 2.22秒[2] | 1.35秒 |
248
221
  | インストール方法 | gem install | cpanm, cpm |
249
222
  | 依存モジュール数(コアモジュールを除く) | 1モジュール | 2モジュール |
250
- | LOC:ソースコードの行数 | 11700行 | 8300行 |
251
- | テスト件数(spec/,t/,xt/ディレクトリ) | 227700件 | 250000件 |
223
+ | LOC:ソースコードの行数 | 10300行 | 7100行 |
224
+ | テスト件数(spec/,t/,xt/ディレクトリ) | 230000件 | 250000件 |
252
225
  | ライセンス | 二条項BSD | 二条項BSD |
253
226
  | 開発会社によるサポート契約 | 提供中 | 提供中 |
254
227
 
@@ -303,7 +276,7 @@ Author
303
276
 
304
277
  Copyright
305
278
  ===============================================================================
306
- Copyright (C) 2015-2019 azumakuniyuki, All Rights Reserved.
279
+ Copyright (C) 2015-2020 azumakuniyuki, All Rights Reserved.
307
280
 
308
281
  License
309
282
  ===============================================================================
data/README.md CHANGED
@@ -19,7 +19,6 @@
19
19
  - [Usage](#usage)
20
20
  - [Basic usage](#basic-usage)
21
21
  - [Convert to JSON](#convert-to-json)
22
- - [Read bounce object](#read-bounce-object)
23
22
  - [Callback feature](#callback-feature)
24
23
  - [One-Liner](#one-liner)
25
24
  - [Output example](#output-example)
@@ -55,8 +54,6 @@ Key Features
55
54
  * 2 times higher than bounceHammer
56
55
  * Support 24 known MTAs and 5 unknown MTAs
57
56
  * Support 22 major MSPs(Mail Service Providers)
58
- * Support 2 major Cloud Email Delivery Services(JSON format)
59
- * **WILL BE REMOVED AT Sisimai 4.25.5**
60
57
  * Support Feedback Loop Message(ARF)
61
58
  * Can detect 29 error reasons
62
59
 
@@ -86,10 +83,10 @@ Install
86
83
 
87
84
  ```shell
88
85
  $ sudo gem install sisimai
89
- Fetching: sisimai-4.25.1.gem (100%)
90
- Successfully installed sisimai-4.25.1
91
- Parsing documentation for sisimai-4.25.1
92
- Installing ri documentation for sisimai-4.25.1
86
+ Fetching: sisimai-4.25.5.gem (100%)
87
+ Successfully installed sisimai-4.25.5
88
+ Parsing documentation for sisimai-4.25.5
89
+ Installing ri documentation for sisimai-4.25.5
93
90
  Done installing documentation for sisimai after 6 seconds
94
91
  1 gem installed
95
92
  ```
@@ -105,8 +102,8 @@ gem install bundle rake rspec coveralls
105
102
  ...
106
103
  4 gems installed
107
104
  bundle exec rake install
108
- sisimai 4.25.1 built to pkg/sisimai-4.25.1.gem.
109
- sisimai (4.25.1) installed.
105
+ sisimai 4.25.5 built to pkg/sisimai-4.25.5.gem.
106
+ sisimai (4.25.5) installed.
110
107
  ```
111
108
 
112
109
  Usage
@@ -164,30 +161,6 @@ puts Sisimai.dump('/path/to/mbox') # or path to Maildir/
164
161
  puts Sisimai.dump('/path/to/mbox', delivered: true)
165
162
  ```
166
163
 
167
- Read bounce object
168
- -------------------------------------------------------------------------------
169
- **THIS FEATURE WILL BE REMOVED AT SISIMAI 4.25.5**
170
-
171
- The way to read a bounce object retrived from Cloud Email Services as JSON using
172
- their API is the following code. This feature is available at between v4.20.0
173
- and **v4.25.5**.
174
-
175
- ```ruby
176
- #! /usr/bin/env ruby
177
- require 'json'
178
- require 'sisimai'
179
-
180
- j = JSON.load('{"notificationType"=>"Bounce", "bounce"=>{"...') # JSON String
181
- v = Sisimai.make(j, input: 'json')
182
-
183
- if v.is_a? Array
184
- v.each do |e|
185
- ...
186
- end
187
- end
188
- ```
189
- As of present, Only Amazon SES and SendGrid are supported.
190
-
191
164
  Callback feature
192
165
  -------------------------------------------------------------------------------
193
166
  Beginning with Sisimai 4.19.0, `make()` and `dump()` methods of Sisimai accept
@@ -248,11 +221,11 @@ and bounceHammer are available at
248
221
  | System requirements | Ruby 2.1 - 2.6 | Perl 5.10 - |
249
222
  | | JRuby 9.0.4.0- | |
250
223
  | Analytical precision ratio(2000 emails)[1] | 1.00 | 1.00 |
251
- | The speed of parsing email(1000 emails) | 2.22s[2] | 1.50s |
224
+ | The speed of parsing email(1000 emails) | 2.22s[2] | 1.35s |
252
225
  | How to install | gem install | cpanm, cpm |
253
226
  | Dependencies (Except core modules) | 1 module | 2 modules |
254
- | LOC:Source lines of code | 11700 lines | 8300 lines |
255
- | The number of tests(spec/,t/,xt/) directory | 227600 tests | 250000 tests |
227
+ | LOC:Source lines of code | 10300 lines | 7100 lines |
228
+ | The number of tests(spec/,t/,xt/) directory | 230000 tests | 250000 tests |
256
229
  | License | BSD 2-Clause | BSD 2-Clause |
257
230
  | Support Contract provided by Developer | Available | Available |
258
231
 
@@ -309,7 +282,7 @@ Author
309
282
 
310
283
  Copyright
311
284
  ===============================================================================
312
- Copyright (C) 2015-2019 azumakuniyuki, All Rights Reserved.
285
+ Copyright (C) 2015-2020 azumakuniyuki, All Rights Reserved.
313
286
 
314
287
  License
315
288
  ===============================================================================
@@ -19,82 +19,34 @@ module Sisimai
19
19
  # @param [Hash] argv1 Parser options(delivered=false)
20
20
  # @options argv1 [Boolean] delivered true: Include "delivered" reason
21
21
  # @options argv1 [Lambda] hook Lambda object to be called back
22
- # @options argv1 [String] input Input data format: 'email', 'json'
23
22
  # @options argv1 [Array] field Email header name to be captured
24
23
  # @return [Array] Parsed objects
25
24
  # @return [nil] nil if the argument was wrong or an empty array
26
25
  def make(argv0, **argv1)
27
26
  return nil unless argv0
28
27
 
29
- input = argv1[:input] || nil
30
28
  field = argv1[:field] || []
31
29
  raise ' ***error: "field" accepts an array only' unless field.is_a? Array
32
30
 
33
- unless input
34
- klass = argv0.class
35
- # "input" did not specified, try to detect automatically.
36
- if klass == ::String || klass == IO
37
- # The argument may be a path to email OR an email text
38
- input = 'email'
39
- elsif klass == Array || klass == Hash
40
- # The argument may be a decoded JSON object
41
- input = 'json'
42
- end
43
- end
44
-
45
- delivered1 = argv1[:delivered] || false
46
- hookmethod = argv1[:hook] || nil
47
- bouncedata = []
48
-
49
31
  require 'sisimai/data'
50
32
  require 'sisimai/message'
51
- if input == 'email'
52
- # Path to mailbox or Maildir/, or STDIN: 'input' => 'email'
53
- require 'sisimai/mail'
54
- return nil unless mail = Sisimai::Mail.new(argv0)
55
-
56
- while r = mail.read do
57
- # Read and parse each mail file
58
- methodargv = { data: r, hook: hookmethod, input: 'email', field: field }
59
- mesg = Sisimai::Message.new(methodargv)
60
- next if mesg.void
61
-
62
- methodargv = { data: mesg, hook: hookmethod, input: 'email', delivered: delivered1 }
63
- next unless data = Sisimai::Data.make(methodargv)
64
- bouncedata += data unless data.empty?
65
- end
66
-
67
- elsif input == 'json'
68
- # Decoded JSON object: 'input' => 'json'
69
- warn ' ***warning: input: "json" is marked as obsoleted'
70
- type = argv0.class.to_s
71
- list = []
72
-
73
- if type == 'Array'
74
- # [ {...}, {...}, ... ]
75
- while e = argv0.shift do
76
- list << e
77
- end
78
- else
79
- list << argv0
80
- end
81
-
82
- while e = list.shift do
83
- methodargv = { data: e, hook: hookmethod, input: 'json' }
84
- mesg = Sisimai::Message.new(methodargv)
85
- next if mesg.void
86
-
87
- methodargv = { data: mesg, hook: hookmethod, input: 'json', delivered: delivered1 }
88
- next unless data = Sisimai::Data.make(methodargv)
89
- bouncedata += data unless data.empty?
90
- end
91
- else
92
- # The value of "input" neither "email" nor "json"
93
- raise ' ***error: invalid value of "input"'
33
+ require 'sisimai/mail'
34
+
35
+ list = []
36
+ return nil unless mail = Sisimai::Mail.new(argv0)
37
+ while r = mail.read do
38
+ # Read and parse each mail file
39
+ methodargv = { data: r, hook: argv1[:hook], field: field }
40
+ mesg = Sisimai::Message.new(methodargv)
41
+ next if mesg.void
42
+
43
+ methodargv = { data: mesg, delivered: argv1[:delivered] }
44
+ next unless data = Sisimai::Data.make(methodargv)
45
+ list += data unless data.empty?
94
46
  end
95
47
 
96
- return nil if bouncedata.empty?
97
- return bouncedata
48
+ return nil if list.empty?
49
+ return list
98
50
  end
99
51
 
100
52
  # Wrapper method to parse mailbox/Maildir and dump as JSON
@@ -104,7 +56,6 @@ module Sisimai
104
56
  # @param [Hash] argv1 Parser options
105
57
  # @options argv1 [Integer] delivered true: Include "delivered" reason
106
58
  # @options argv1 [Lambda] hook Lambda object to be called back
107
- # @options argv1 [String] input Input data format: 'email', 'json'
108
59
  # @return [String] Parsed data as JSON text
109
60
  def dump(argv0, **argv1)
110
61
  return nil unless argv0
@@ -30,7 +30,7 @@ module Sisimai
30
30
  # # => Sisimai::Address object
31
31
  def self.make(argvs)
32
32
  return nil unless argvs.is_a? Hash
33
- return nil unless argvs.key?(:address)
33
+ return nil unless argvs[:address]
34
34
  return nil if argvs[:address].empty?
35
35
 
36
36
  thing = Sisimai::Address.new(argvs[:address])
@@ -69,7 +69,7 @@ module Sisimai
69
69
 
70
70
  while e = characters.shift do
71
71
  # Check each characters
72
- if Delimiters.key?(e)
72
+ if Delimiters[e]
73
73
  # The character is a delimiter character
74
74
  if e == ','
75
75
  # Separator of email addresses or not
@@ -283,7 +283,7 @@ module Sisimai
283
283
  # expand_verp('bounce+neko=example.org@example.org') #=> 'neko@example.org'
284
284
  def self.expand_verp(email)
285
285
  return nil unless email.is_a? Object::String
286
- return nil unless cv = email.split('@', 2).first.match(/\A[-_\w]+?[+](\w[-._\w]+\w)[=](\w[-.\w]+\w)\z/)
286
+ return nil unless cv = email.split('@', 2).first.match(/\A[-\w]+?[+](\w[-.\w]+\w)[=](\w[-.\w]+\w)\z/)
287
287
  verp0 = cv[1] + '@' + cv[2]
288
288
  return verp0 if Sisimai::RFC5322.is_emailaddress(verp0)
289
289
  end
@@ -297,23 +297,19 @@ module Sisimai
297
297
  return nil unless Sisimai::RFC5322.is_emailaddress(email)
298
298
 
299
299
  local = email.split('@')
300
- return nil unless cv = local[0].match(/\A([-_\w]+?)[+].+\z/)
300
+ return nil unless cv = local[0].match(/\A([-\w]+?)[+].+\z/)
301
301
  return cv[1] + '@' + local[1]
302
302
  end
303
303
 
304
- @@roaccessors = [
305
- :address, # [String] Email address
306
- :user, # [String] local part of the email address
307
- :host, # [String] domain part of the email address
308
- :verp, # [String] VERP
309
- :alias, # [String] alias of the email address
310
- ]
311
- @@rwaccessors = [
312
- :name, # [String] Display name
313
- :comment, # [String] Comment
314
- ]
315
- @@roaccessors.each { |e| attr_reader e }
316
- @@rwaccessors.each { |e| attr_accessor e }
304
+ # :address, # [String] Email address
305
+ # :user, # [String] local part of the email address
306
+ # :host, # [String] domain part of the email address
307
+ # :verp, # [String] VERP
308
+ # :alias, # [String] alias of the email address
309
+ # :name, # [String] Display name
310
+ # :comment, # [String] Comment
311
+ attr_reader :address, :user, :host, :verp, :alias
312
+ attr_accessor :name, :comment
317
313
 
318
314
  # Constructor of Sisimai::Address
319
315
  # @param <str> [String] argv1 Email address
@@ -80,7 +80,7 @@ module Sisimai
80
80
  return nil unless self.is_arf(mhead)
81
81
 
82
82
  dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
83
- hasdivided = mbody.split("\n")
83
+ bodyslices = mbody.split("\n")
84
84
  rfc822part = '' # (String) message/rfc822-headers part
85
85
  previousfn = '' # (String) Previous field name
86
86
  readcursor = 0 # (Integer) Points the current cursor position
@@ -120,7 +120,7 @@ module Sisimai
120
120
  # generator is using to generate the report. The version number in
121
121
  # this specification is set to "1".
122
122
  #
123
- while e = hasdivided.shift do
123
+ while e = bodyslices.shift do
124
124
  if readcursor == 0
125
125
  # Beginning of the bounce message or message/delivery-status part
126
126
  if e =~ MarkingsOf[:message]
@@ -156,7 +156,7 @@ module Sisimai
156
156
 
157
157
  elsif e.start_with?(' ', "\t")
158
158
  # Continued line from the previous line
159
- rfc822part << e + "\n" if LongFields.key?(previousfn)
159
+ rfc822part << e + "\n" if LongFields[previousfn]
160
160
  next unless e.empty?
161
161
  rcptintext << e if previousfn == 'to'
162
162
 
@@ -167,7 +167,7 @@ module Sisimai
167
167
  lhs.downcase!
168
168
 
169
169
  previousfn = ''
170
- next unless RFC822Head.key?(lhs)
170
+ next unless RFC822Head[lhs]
171
171
 
172
172
  previousfn = lhs
173
173
  rfc822part << e + "\n"