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.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/ChangeLog.md +50 -0
- data/README-JA.md +10 -37
- data/README.md +10 -37
- data/lib/sisimai.rb +15 -64
- data/lib/sisimai/address.rb +13 -17
- data/lib/sisimai/arf.rb +4 -4
- data/lib/sisimai/data.rb +3 -5
- data/lib/sisimai/lhost.rb +0 -14
- data/lib/sisimai/lhost/activehunter.rb +31 -55
- data/lib/sisimai/lhost/amavis.rb +41 -66
- data/lib/sisimai/lhost/amazonses.rb +189 -235
- data/lib/sisimai/lhost/amazonworkmail.rb +48 -71
- data/lib/sisimai/lhost/aol.rb +49 -75
- data/lib/sisimai/lhost/apachejames.rb +60 -83
- data/lib/sisimai/lhost/bigfoot.rb +61 -85
- data/lib/sisimai/lhost/biglobe.rb +40 -62
- data/lib/sisimai/lhost/courier.rb +60 -82
- data/lib/sisimai/lhost/domino.rb +50 -76
- data/lib/sisimai/lhost/einsundeins.rb +57 -55
- data/lib/sisimai/lhost/exchange2003.rb +79 -101
- data/lib/sisimai/lhost/exchange2007.rb +66 -74
- data/lib/sisimai/lhost/exim.rb +119 -142
- data/lib/sisimai/lhost/ezweb.rb +53 -73
- data/lib/sisimai/lhost/facebook.rb +49 -75
- data/lib/sisimai/lhost/fml.rb +25 -50
- data/lib/sisimai/lhost/gmx.rb +55 -79
- data/lib/sisimai/lhost/google.rb +39 -66
- data/lib/sisimai/lhost/gsuite.rb +74 -94
- data/lib/sisimai/lhost/imailserver.rb +34 -67
- data/lib/sisimai/lhost/interscanmss.rb +33 -67
- data/lib/sisimai/lhost/kddi.rb +30 -52
- data/lib/sisimai/lhost/mailfoundry.rb +35 -57
- data/lib/sisimai/lhost/mailmarshalsmtp.rb +66 -89
- data/lib/sisimai/lhost/mailru.rb +51 -76
- data/lib/sisimai/lhost/mcafee.rb +53 -79
- data/lib/sisimai/lhost/messagelabs.rb +49 -75
- data/lib/sisimai/lhost/messagingserver.rb +91 -113
- data/lib/sisimai/lhost/mfilter.rb +50 -70
- data/lib/sisimai/lhost/mxlogic.rb +38 -63
- data/lib/sisimai/lhost/notes.rb +53 -82
- data/lib/sisimai/lhost/office365.rb +64 -81
- data/lib/sisimai/lhost/opensmtpd.rb +30 -52
- data/lib/sisimai/lhost/outlook.rb +49 -75
- data/lib/sisimai/lhost/postfix.rb +116 -117
- data/lib/sisimai/lhost/qmail.rb +33 -55
- data/lib/sisimai/lhost/receivingses.rb +49 -75
- data/lib/sisimai/lhost/sendgrid.rb +68 -203
- data/lib/sisimai/lhost/sendmail.rb +101 -125
- data/lib/sisimai/lhost/surfcontrol.rb +53 -79
- data/lib/sisimai/lhost/userdefined.rb +15 -35
- data/lib/sisimai/lhost/v5sendmail.rb +59 -89
- data/lib/sisimai/lhost/verizon.rb +75 -124
- data/lib/sisimai/lhost/x1.rb +30 -54
- data/lib/sisimai/lhost/x2.rb +28 -52
- data/lib/sisimai/lhost/x3.rb +44 -68
- data/lib/sisimai/lhost/x4.rb +34 -58
- data/lib/sisimai/lhost/x5.rb +42 -70
- data/lib/sisimai/lhost/yahoo.rb +44 -68
- data/lib/sisimai/lhost/yandex.rb +59 -85
- data/lib/sisimai/lhost/zoho.rb +54 -78
- data/lib/sisimai/mail.rb +5 -9
- data/lib/sisimai/mail/maildir.rb +10 -14
- data/lib/sisimai/mail/mbox.rb +8 -12
- data/lib/sisimai/mail/memory.rb +5 -9
- data/lib/sisimai/mail/stdin.rb +7 -11
- data/lib/sisimai/mda.rb +2 -2
- data/lib/sisimai/message.rb +51 -154
- data/lib/sisimai/mime.rb +2 -2
- data/lib/sisimai/order.rb +2 -27
- data/lib/sisimai/reason.rb +3 -5
- data/lib/sisimai/rfc1894.rb +1 -1
- data/lib/sisimai/rfc3464.rb +29 -29
- data/lib/sisimai/rfc3834.rb +7 -6
- data/lib/sisimai/rfc5322.rb +20 -31
- data/lib/sisimai/rhost/franceptt.rb +120 -24
- data/lib/sisimai/rhost/iua.rb +1 -1
- data/lib/sisimai/smtp/error.rb +7 -7
- data/lib/sisimai/version.rb +1 -1
- data/set-of-emails/maildir/bsd/email-einsundeins-03.eml +66 -0
- data/set-of-emails/maildir/bsd/email-exchange2007-05.eml +1469 -0
- data/set-of-emails/maildir/bsd/email-exchange2007-06.eml +764 -0
- data/set-of-emails/maildir/bsd/email-postfix-64.eml +96 -0
- data/set-of-emails/maildir/bsd/rfc3834-03.eml +26 -0
- data/set-of-emails/maildir/bsd/rhost-franceptt-04.eml +66 -0
- data/set-of-emails/maildir/bsd/rhost-franceptt-05.eml +96 -0
- data/set-of-emails/maildir/bsd/rhost-franceptt-06.eml +100 -0
- data/set-of-emails/maildir/bsd/rhost-franceptt-07.eml +97 -0
- data/set-of-emails/maildir/bsd/rhost-franceptt-08.eml +78 -0
- data/set-of-emails/maildir/bsd/rhost-franceptt-10.eml +79 -0
- data/set-of-emails/maildir/bsd/rhost-franceptt-11.eml +96 -0
- metadata +14 -9
- data/lib/sisimai/bite.rb +0 -42
- data/lib/sisimai/bite/email.rb +0 -18
- data/lib/sisimai/bite/json.rb +0 -16
- data/lib/sisimai/message/email.rb +0 -26
- data/lib/sisimai/message/json.rb +0 -24
- data/lib/sisimai/order/email.rb +0 -20
- data/lib/sisimai/order/json.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf50fe472bdf358908619b5571800aa29c181ed59c11bcc52718c504f54ec991
|
4
|
+
data.tar.gz: d764cfda21b0b8c49e53f50b5ddd7527665e8c9721a5c4a1bebb8e9dc9eac2a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce283bb17ad9beb4a82186e653a67c92e6357652db7148c30ad69ae5ab9d6734a49a5c88b0ac2c6302cb13274350644ca4651fafa3aa5eaf96edc0a49c73a849
|
7
|
+
data.tar.gz: 9cbd0b351b7166af32183255e492cd4490017a037443e867bc63d6ca13939d7d5cc123b903464c711628bb4497a14d86de027e547abe55aed788e78286b85367
|
data/.travis.yml
CHANGED
data/ChangeLog.md
CHANGED
@@ -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)"
|
data/README-JA.md
CHANGED
@@ -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.
|
85
|
-
Successfully installed sisimai-4.25.
|
86
|
-
Parsing documentation for sisimai-4.25.
|
87
|
-
Installing ri documentation for sisimai-4.25.
|
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.
|
104
|
-
sisimai (4.25.
|
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.
|
220
|
+
| メール解析速度(1000通のメール) | 2.22秒[2] | 1.35秒 |
|
248
221
|
| インストール方法 | gem install | cpanm, cpm |
|
249
222
|
| 依存モジュール数(コアモジュールを除く) | 1モジュール | 2モジュール |
|
250
|
-
| LOC:ソースコードの行数 |
|
251
|
-
| テスト件数(spec/,t/,xt/ディレクトリ) |
|
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-
|
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.
|
90
|
-
Successfully installed sisimai-4.25.
|
91
|
-
Parsing documentation for sisimai-4.25.
|
92
|
-
Installing ri documentation for sisimai-4.25.
|
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.
|
109
|
-
sisimai (4.25.
|
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.
|
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 |
|
255
|
-
| The number of tests(spec/,t/,xt/) directory |
|
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-
|
285
|
+
Copyright (C) 2015-2020 azumakuniyuki, All Rights Reserved.
|
313
286
|
|
314
287
|
License
|
315
288
|
===============================================================================
|
data/lib/sisimai.rb
CHANGED
@@ -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
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
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
|
97
|
-
return
|
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
|
data/lib/sisimai/address.rb
CHANGED
@@ -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
|
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
|
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[
|
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([
|
300
|
+
return nil unless cv = local[0].match(/\A([-\w]+?)[+].+\z/)
|
301
301
|
return cv[1] + '@' + local[1]
|
302
302
|
end
|
303
303
|
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
]
|
311
|
-
|
312
|
-
|
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
|
data/lib/sisimai/arf.rb
CHANGED
@@ -80,7 +80,7 @@ module Sisimai
|
|
80
80
|
return nil unless self.is_arf(mhead)
|
81
81
|
|
82
82
|
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
83
|
-
|
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 =
|
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
|
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
|
170
|
+
next unless RFC822Head[lhs]
|
171
171
|
|
172
172
|
previousfn = lhs
|
173
173
|
rfc822part << e + "\n"
|