sisimai 4.20.1 → 4.20.2

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 (82) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +12 -2
  3. data/Changes +11 -1
  4. data/README-JA.md +135 -202
  5. data/README.md +128 -192
  6. data/fig/sisimai-architecture.png +0 -0
  7. data/lib/sisimai.rb +5 -3
  8. data/lib/sisimai/arf.rb +2 -2
  9. data/lib/sisimai/ced/us/amazonses.rb +5 -5
  10. data/lib/sisimai/ced/us/sendgrid.rb +4 -4
  11. data/lib/sisimai/data.rb +1 -8
  12. data/lib/sisimai/data/json.rb +1 -1
  13. data/lib/sisimai/datetime.rb +1 -1
  14. data/lib/sisimai/mail/maildir.rb +3 -3
  15. data/lib/sisimai/mda.rb +2 -2
  16. data/lib/sisimai/message.rb +7 -3
  17. data/lib/sisimai/message/email.rb +8 -2
  18. data/lib/sisimai/mime.rb +2 -2
  19. data/lib/sisimai/msp/de/einsundeins.rb +2 -2
  20. data/lib/sisimai/msp/de/gmx.rb +2 -2
  21. data/lib/sisimai/msp/jp/biglobe.rb +2 -2
  22. data/lib/sisimai/msp/jp/ezweb.rb +2 -2
  23. data/lib/sisimai/msp/jp/kddi.rb +3 -3
  24. data/lib/sisimai/msp/ru/mailru.rb +3 -3
  25. data/lib/sisimai/msp/ru/yandex.rb +2 -2
  26. data/lib/sisimai/msp/uk/messagelabs.rb +2 -2
  27. data/lib/sisimai/msp/us/amazonses.rb +4 -5
  28. data/lib/sisimai/msp/us/amazonworkmail.rb +2 -2
  29. data/lib/sisimai/msp/us/aol.rb +2 -2
  30. data/lib/sisimai/msp/us/bigfoot.rb +3 -3
  31. data/lib/sisimai/msp/us/facebook.rb +2 -2
  32. data/lib/sisimai/msp/us/google.rb +2 -2
  33. data/lib/sisimai/msp/us/office365.rb +2 -3
  34. data/lib/sisimai/msp/us/outlook.rb +2 -2
  35. data/lib/sisimai/msp/us/receivingses.rb +2 -2
  36. data/lib/sisimai/msp/us/sendgrid.rb +2 -2
  37. data/lib/sisimai/msp/us/verizon.rb +3 -3
  38. data/lib/sisimai/msp/us/yahoo.rb +2 -2
  39. data/lib/sisimai/msp/us/zoho.rb +2 -2
  40. data/lib/sisimai/mta/activehunter.rb +2 -2
  41. data/lib/sisimai/mta/apachejames.rb +3 -3
  42. data/lib/sisimai/mta/courier.rb +3 -3
  43. data/lib/sisimai/mta/domino.rb +2 -2
  44. data/lib/sisimai/mta/exchange2003.rb +4 -4
  45. data/lib/sisimai/mta/exchange2007.rb +2 -2
  46. data/lib/sisimai/mta/exim.rb +8 -4
  47. data/lib/sisimai/mta/imailserver.rb +3 -3
  48. data/lib/sisimai/mta/interscanmss.rb +3 -3
  49. data/lib/sisimai/mta/mailfoundry.rb +2 -2
  50. data/lib/sisimai/mta/mailmarshalsmtp.rb +2 -2
  51. data/lib/sisimai/mta/mcafee.rb +2 -2
  52. data/lib/sisimai/mta/messagingserver.rb +3 -3
  53. data/lib/sisimai/mta/mfilter.rb +2 -2
  54. data/lib/sisimai/mta/mxlogic.rb +3 -3
  55. data/lib/sisimai/mta/notes.rb +3 -3
  56. data/lib/sisimai/mta/opensmtpd.rb +2 -2
  57. data/lib/sisimai/mta/postfix.rb +3 -3
  58. data/lib/sisimai/mta/qmail.rb +3 -3
  59. data/lib/sisimai/mta/sendmail.rb +2 -2
  60. data/lib/sisimai/mta/surfcontrol.rb +2 -2
  61. data/lib/sisimai/mta/userdefined.rb +3 -3
  62. data/lib/sisimai/mta/v5sendmail.rb +3 -3
  63. data/lib/sisimai/mta/x1.rb +2 -2
  64. data/lib/sisimai/mta/x2.rb +2 -2
  65. data/lib/sisimai/mta/x3.rb +2 -2
  66. data/lib/sisimai/mta/x4.rb +3 -3
  67. data/lib/sisimai/mta/x5.rb +3 -3
  68. data/lib/sisimai/reason/rejected.rb +1 -0
  69. data/lib/sisimai/reason/securityerror.rb +7 -2
  70. data/lib/sisimai/reason/toomanyconn.rb +4 -0
  71. data/lib/sisimai/rfc3464.rb +3 -3
  72. data/lib/sisimai/rfc3834.rb +2 -2
  73. data/lib/sisimai/rfc5322.rb +4 -4
  74. data/lib/sisimai/rhost.rb +0 -1
  75. data/lib/sisimai/rhost/exchangeonline.rb +2 -2
  76. data/lib/sisimai/smtp.rb +4 -4
  77. data/lib/sisimai/smtp/error.rb +7 -12
  78. data/lib/sisimai/smtp/reply.rb +1 -1
  79. data/lib/sisimai/string.rb +7 -7
  80. data/lib/sisimai/version.rb +1 -1
  81. data/set-of-emails/maildir/bsd/rfc3834-06.eml +56 -0
  82. metadata +5 -3
data/README.md CHANGED
@@ -1,22 +1,53 @@
1
+ ![](http://libsisimai.org/static/images/logo/sisimai-x01.png)
2
+
1
3
  [![License](https://img.shields.io/badge/license-BSD%202--Clause-orange.svg)](https://github.com/sisimai/rb-Sisimai/blob/master/LICENSE)
2
4
  [![Coverage Status](https://img.shields.io/coveralls/sisimai/rb-Sisimai.svg)](https://coveralls.io/r/sisimai/rb-Sisimai)
3
5
  [![Build Status](https://travis-ci.org/sisimai/rb-Sisimai.svg?branch=master)](https://travis-ci.org/sisimai/rb-Sisimai)
4
6
  [![Codacy Badge](https://api.codacy.com/project/badge/grade/38340177e6284a65be69c0c7c3dc2b58)](https://www.codacy.com/app/azumakuniyuki/rb-Sisimai)
5
- [![Ruby](https://img.shields.io/badge/ruby-v2.1.0--v2.3.0-red.svg)](https://www.ruby-lang.org/)
7
+ [![Ruby](https://img.shields.io/badge/ruby-v2.1.0--v2.4.0-red.svg)](https://www.ruby-lang.org/)
6
8
  [![Gem Version](https://badge.fury.io/rb/sisimai.svg)](https://badge.fury.io/rb/sisimai)
7
9
 
8
- ![](http://41.media.tumblr.com/45c8d33bea2f92da707f4bbe66251d6b/tumblr_nuf7bgeyH51uz9e9oo1_1280.png)
9
-
10
- What is Sisimai ?
11
- =================
10
+ - [**README-JA(日本語)**](README-JA.md)
11
+ - [What is Sisimai](#what-is-sisimai)
12
+ - [Key features](#key-features)
13
+ - [Command line demo](#command-line-demo)
14
+ - [Setting Up Sisimai](#setting-up-sisimai)
15
+ - [System requirements](#system-requirements)
16
+ - [Install](#install)
17
+ - [From RubyGems](#from-rubygems)
18
+ - [From GitHub](#from-github)
19
+ - [Usage](#usage)
20
+ - [Basic usage](#basic-usage)
21
+ - [Convert to JSON](#convert-to-json)
22
+ - [Read bounce object](#read-bounce-object)
23
+ - [Callback feature](#callback-feature)
24
+ - [One-Liner](#one-liner)
25
+ - [Output example](#output-example)
26
+ - [Sisimai Specification](#sisimai-specification)
27
+ - [Differences between Ruby version and Perl version](#differences-between-ruby-version-and-perl-version)
28
+ - [Other specification of Sisimai](#other-specification-of-sisimai)
29
+ - [Contributing](#contributing)
30
+ - [Bug report](#bug-report)
31
+ - [Emails could not be parsed](#emails-could-not-be-parsed)
32
+ - [Other Information](#other-information)
33
+ - [Related sites](#related-sites)
34
+ - [See also](#see-also)
35
+ - [Author](#author)
36
+ - [Copyright](#copyright)
37
+ - [License](#license)
38
+
39
+ What is Sisimai
40
+ ===============================================================================
12
41
  Sisimai is a Ruby library for analyzing RFC5322 bounce emails and generating
13
42
  structured data from parsed results. The Ruby version of Sisimai is ported from
14
43
  the Perl version of Sisimai at [github.com/sisimai/p5-Sisimai](https://github.com/sisimai/p5-Sisimai/).
15
44
 
45
+ ![](http://libsisimai.org/static/images/figure/sisimai-overview-1.png)
46
+
16
47
  Key Features
17
- ------------
48
+ -------------------------------------------------------------------------------
18
49
  * __Convert Bounce Mails to Structured Data__
19
- * Supported formats are Perl and JSON
50
+ * Supported formats are Ruby(Hash, Array) and JSON(String)
20
51
  * __Easy to Install, Use.__
21
52
  * gem install
22
53
  * git clone & make
@@ -28,10 +59,17 @@ Key Features
28
59
  * Support Feedback Loop Message(ARF)
29
60
  * Can detect 27 error reasons
30
61
 
62
+ Command line demo
63
+ -------------------------------------------------------------------------------
64
+ The following screen shows a demonstration of Sisimai at the command line using
65
+ Ruby(rb-Sisimai) and Perl(p5-Sisimai) version of Sisimai.
66
+ ![](http://libsisimai.org/static/images/demo/sisimai-dump-01.gif)
67
+
31
68
  Setting Up Sisimai
32
- ==================
69
+ ===============================================================================
70
+
33
71
  System requirements
34
- -------------------
72
+ -------------------------------------------------------------------------------
35
73
  More details about system requirements are available at
36
74
  [Sisimai | Getting Started](http://libsisimai.org/en/start) page.
37
75
 
@@ -42,15 +80,15 @@ More details about system requirements are available at
42
80
  * [__JrJackson | A mostly native JRuby wrapper for the java jackson json processor jar__](https://rubygems.org/gems/jrjackson)
43
81
 
44
82
  Install
45
- ----------------------
46
- ### From RubyGems.org
83
+ -------------------------------------------------------------------------------
84
+ ### From RubyGems
47
85
 
48
86
  ```shell
49
- % sudo gem install sisimai
50
- Fetching: sisimai-4.20.0.gem (100%)
51
- Successfully installed sisimai-4.20.0
52
- Parsing documentation for sisimai-4.20.0
53
- Installing ri documentation for sisimai-4.20.0
87
+ $ sudo gem install sisimai
88
+ Fetching: sisimai-4.20.2.gem (100%)
89
+ Successfully installed sisimai-4.20.2
90
+ Parsing documentation for sisimai-4.20.2
91
+ Installing ri documentation for sisimai-4.20.2
54
92
  Done installing documentation for sisimai after 6 seconds
55
93
  1 gem installed
56
94
  ```
@@ -58,22 +96,23 @@ Done installing documentation for sisimai after 6 seconds
58
96
  ### From GitHub
59
97
 
60
98
  ```shell
61
- % cd /usr/local/src
62
- % git clone https://github.com/sisimai/rb-Sisimai.git
63
- % cd ./rb-Sisimai
64
- % sudo make depend install-from-local
99
+ $ cd /usr/local/src
100
+ $ git clone https://github.com/sisimai/rb-Sisimai.git
101
+ $ cd ./rb-Sisimai
102
+ $ sudo make depend install-from-local
65
103
  gem install bundle rake rspec coveralls
66
104
  ...
67
105
  4 gems installed
68
106
  bundle exec rake install
69
- sisimai 4.20.0 built to pkg/sisimai-4.20.0.gem.
70
- sisimai (4.20.0) installed.
107
+ sisimai 4.20.2 built to pkg/sisimai-4.20.2.gem.
108
+ sisimai (4.20.2) installed.
71
109
  ```
72
110
 
73
111
  Usage
74
- =====
112
+ ===============================================================================
113
+
75
114
  Basic usage
76
- -----------
115
+ -------------------------------------------------------------------------------
77
116
  `make()` method provides feature for getting parsed data from bounced email
78
117
  messages like following.
79
118
 
@@ -104,7 +143,14 @@ if v.is_a? Array
104
143
  puts e.dump('json') # JSON formatted bounce data
105
144
  end
106
145
  end
146
+ ```
107
147
 
148
+ Convert to JSON
149
+ -------------------------------------------------------------------------------
150
+ `Sisimai.dump()` method provides feature for getting parsed data as JSON string
151
+ from bounced email messages like following.
152
+
153
+ ```ruby
108
154
  # Get JSON string from parsed mailbox or Maildir/
109
155
  puts Sisimai.dump('/path/to/mbox') # or path to Maildir/
110
156
 
@@ -112,8 +158,8 @@ puts Sisimai.dump('/path/to/mbox') # or path to Maildir/
112
158
  puts Sisimai.dump('/path/to/mbox', delivered: true)
113
159
  ```
114
160
 
115
- Read bounce object(JSON)
116
- ------------------------
161
+ Read bounce object
162
+ -------------------------------------------------------------------------------
117
163
  The way to read a bounce object retrived from Cloud Email Services as JSON using
118
164
  their API is the following code. This feature is available at Sisimai 4.20.0 or
119
165
  later.
@@ -134,8 +180,8 @@ end
134
180
  ```
135
181
  As of present, Only Amazon SES and SendGrid are supported.
136
182
 
137
- Callback Feature
138
- ----------------
183
+ Callback feature
184
+ -------------------------------------------------------------------------------
139
185
  Beginning with Sisimai 4.19.0, `make()` and `dump()` methods of Sisimai accept
140
186
  a Lambda (Proc object) in `hook` argument for setting a callback method and
141
187
  getting the results generated by the method via `Sisimai::Data.catch` method.
@@ -144,16 +190,18 @@ getting the results generated by the method via `Sisimai::Data.catch` method.
144
190
  #! /usr/bin/env ruby
145
191
  require 'sisimai'
146
192
  callbackto = lambda do |v|
147
- r = { 'x-mailer' => '' }
193
+ r = { 'x-mailer' => '', 'queue-id' => '' }
148
194
 
149
- if cv = v['message'].match(/^X-Mailer:\s*(.+)$/)
150
- r['x-mailer'] = cv[1]
195
+ if cv = v['message'].match(/^X-Postfix-Queue-ID:\s*(.+)$/)
196
+ r['queue-id'] = cv[1]
151
197
  end
198
+ r['x-mailer'] = v['headers']['x-mailer'] || ''
152
199
  return r
153
200
  end
154
201
 
155
- data = Sisimai.make('/path/to/mbox', hook: callbackto)
156
- json = Sisimai.dump('/path/to/mbox', hook: callbackto)
202
+ list = ['X-Mailer']
203
+ data = Sisimai.make('/path/to/mbox', hook: callbackto, field: list)
204
+ json = Sisimai.dump('/path/to/mbox', hook: callbackto, field: list)
157
205
 
158
206
  puts data[0].catch['x-mailer'] # Apple Mail (2.1283)
159
207
  ```
@@ -163,25 +211,27 @@ More information about the callback feature is available at
163
211
  Page.
164
212
 
165
213
  One-Liner
166
- ---------
214
+ -------------------------------------------------------------------------------
167
215
 
168
216
  ```shell
169
217
  % ruby -rsisimai -e 'puts Sisimai.dump($*.shift)' /path/to/mbox
170
218
  ```
171
219
 
172
- Parsed results as JSON
173
- ----------------------
220
+ Output example
221
+ -------------------------------------------------------------------------------
222
+ ![](http://libsisimai.org/static/images/demo/sisimai-dump-02.gif)
223
+
174
224
  ```json
175
225
  [{"recipient": "kijitora@example.jp", "addresser": "shironeko@1jo.example.org", "feedbacktype": "", "action": "failed", "subject": "Nyaaaaan", "smtpcommand": "DATA", "diagnosticcode": "550 Unknown user kijitora@example.jp", "listid": "", "destination": "example.jp", "smtpagent": "Courier", "lhost": "1jo.example.org", "deliverystatus": "5.0.0", "timestamp": 1291954879, "messageid": "201012100421.oBA4LJFU042012@1jo.example.org", "diagnostictype": "SMTP", "timezoneoffset": "+0900", "reason": "filtered", "token": "ce999a4c869e3f5e4d8a77b2e310b23960fb32ab", "alias": "", "senderdomain": "1jo.example.org", "rhost": "mfsmax.example.jp"}, {"diagnostictype": "SMTP", "timezoneoffset": "+0900", "reason": "userunknown", "timestamp": 1381900535, "messageid": "E1C50F1B-1C83-4820-BC36-AC6FBFBE8568@example.org", "token": "9fe754876e9133aae5d20f0fd8dd7f05b4e9d9f0", "alias": "", "senderdomain": "example.org", "rhost": "mx.bouncehammer.jp", "action": "failed", "addresser": "kijitora@example.org", "recipient": "userunknown@bouncehammer.jp", "feedbacktype": "", "smtpcommand": "DATA", "subject": "バウンスメールのテスト(日本語)", "destination": "bouncehammer.jp", "listid": "", "diagnosticcode": "550 5.1.1 <userunknown@bouncehammer.jp>... User Unknown", "deliverystatus": "5.1.1", "lhost": "p0000-ipbfpfx00kyoto.kyoto.example.co.jp", "smtpagent": "Sendmail"}]
176
226
  ```
177
227
 
178
228
  Sisimai Specification
179
- =====================
229
+ ===============================================================================
180
230
 
181
- Differences between Perl version and Ruby version
182
- -------------------------------------------------
183
- The following table show the differences between Perl version of Sisimai
184
- and Ruby version of Sisimai. Information about differences between Sisimai
231
+ Differences between Ruby version and Perl version
232
+ -------------------------------------------------------------------------------
233
+ The following table show the differences between Ruby version of Sisimai
234
+ and Perl version of Sisimai. Information about differences between Sisimai
185
235
  and bounceHammer are available at
186
236
  [Sisimai | Differences](http://libsisimai.org/en/diff) page.
187
237
 
@@ -193,164 +243,50 @@ and bounceHammer are available at
193
243
  | The speed of parsing email(1000 emails) | 3.30s | 2.33s |
194
244
  | How to install | gem install | cpanm |
195
245
  | Dependencies (Except core modules) | 1 module | 2 modules |
196
- | LOC:Source lines of code | 12200 lines | 8800 lines |
197
- | The number of tests(spec/,t/,xt/) directory | 106400 tests | 188000 tests |
246
+ | LOC:Source lines of code | 12200 lines | 8850 lines |
247
+ | The number of tests(spec/,t/,xt/) directory | 107600 tests | 188000 tests |
198
248
  | License | BSD 2-Clause | BSD 2-Clause |
199
249
  | Support Contract provided by Developer | Coming soon | Available |
200
250
 
201
251
  1. See [./ANALYTICAL-PRECISION](https://github.com/sisimai/rb-Sisimai/blob/master/ANALYTICAL-PRECISION)
202
252
 
203
- MTA/MSP Modules
204
- ---------------
205
- The following table is the list of MTA/MSP:(Mail Service Provider) modules. More
206
- details about these modules are available at
207
- [Sisimai | Parser Engines](http://libsisimai.org/en/engine) page.
208
-
209
- | Module Name(Sisimai::) | Description |
210
- |--------------------------|---------------------------------------------------|
211
- | MTA::Activehunter | TransWARE Active!hunter |
212
- | MTA::ApacheJames | Java Apache Mail Enterprise Server |
213
- | MTA::Courier | Courier MTA |
214
- | MTA::Domino | IBM Domino Server |
215
- | MTA::Exchange2003 | Microsoft Exchange Server 2003 |
216
- | MTA::Exchange2007 | Microsoft Exchange Server 2007 (> v4.18.0) |
217
- | MTA::Exim | Exim |
218
- | MTA::IMailServer | IPSWITCH IMail Server |
219
- | MTA::InterScanMSS | Trend Micro InterScan Messaging Security Suite |
220
- | MTA::MXLogic | McAfee SaaS |
221
- | MTA::MailFoundry | MailFoundry |
222
- | MTA::MailMarshalSMTP | Trustwave Secure Email Gateway |
223
- | MTA::McAfee | McAfee Email Appliance |
224
- | MTA::MessagingServer | Oracle Communications Messaging Server |
225
- | MTA::MFILTER | Digital Arts m-FILTER |
226
- | MTA::Notes | Lotus Notes |
227
- | MTA::OpenSMTPD | OpenSMTPD |
228
- | MTA::Postfix | Postfix |
229
- | MTA::Qmail | qmail |
230
- | MTA::Sendmail | V8Sendmail: /usr/sbin/sendmail |
231
- | MTA::SurfControl | WebSense SurfControl |
232
- | MTA::V5sendmail | Sendmail version 5 |
233
- | MTA::X1 | Unknown MTA #1 |
234
- | MTA::X2 | Unknown MTA #2 |
235
- | MTA::X3 | Unknown MTA #3 |
236
- | MTA::X4 | Unknown MTA #4 qmail clones |
237
- | MTA::X5 | Unknown MTA #5 |
238
- | MSP::DE::EinsUndEins | 1&1: http://www.1and1.de |
239
- | MSP::DE::GMX | GMX: http://www.gmx.net |
240
- | MSP::JP::Biglobe | BIGLOBE: http://www.biglobe.ne.jp |
241
- | MSP::JP::EZweb | au EZweb: http://www.au.kddi.com/mobile/ |
242
- | MSP::JP::KDDI | au by KDDI: http://www.au.kddi.com |
243
- | MSP::RU::MailRu | @mail.ru: https://mail.ru |
244
- | MSP::RU::Yandex | Yandex.Mail: http://www.yandex.ru |
245
- | MSP::UK::MessageLabs | Symantec.cloud http://www.messagelabs.com |
246
- | MSP::US::AmazonSES | AmazonSES(Sending): http://aws.amazon.com/ses/ |
247
- | MSP::US::AmazonWorkMail | Amazon WorkMail: https://aws.amazon.com/workmail/ |
248
- | MSP::US::Aol | Aol Mail: http://www.aol.com |
249
- | MSP::US::Bigfoot | Bigfoot: http://www.bigfoot.com |
250
- | MSP::US::Facebook | Facebook: https://www.facebook.com |
251
- | MSP::US::Google | Google Gmail: https://mail.google.com |
252
- | MSP::US::Office365 | Microsoft Office 365: http://office.microsoft.com/|
253
- | MSP::US::Outlook | Microsoft Outlook.com: https://www.outlook.com/ |
254
- | MSP::US::ReceivingSES | AmazonSES(Receiving): http://aws.amazon.com/ses/ |
255
- | MSP::US::SendGrid | SendGrid: http://sendgrid.com/ |
256
- | MSP::US::Verizon | Verizon Wireless: http://www.verizonwireless.com |
257
- | MSP::US::Yahoo | Yahoo! MAIL: https://www.yahoo.com |
258
- | MSP::US::Zoho | Zoho Mail: https://www.zoho.com |
259
- | CED::US::AmazonSES | AmazonSES(JSON): http://aws.amazon.com/ses/ |
260
- | CED::US::SendGrid | SendGrid(JSON): http://sendgrid.com/ |
261
- | ARF | Abuse Feedback Reporting Format |
262
- | RFC3464 | Fallback Module for MTAs |
263
- | RFC3834 | Detector for auto replied message |
264
-
265
- Bounce Reason List
266
- ------------------
267
- Sisimai can detect the following 27 bounce reasons. More details about reasons
268
- are available at [Sisimai | Bounce Reason List](http://libsisimai.org/en/reason)
269
- page.
270
-
271
- | Reason | Description | Impelmented at |
272
- |----------------|----------------------------------------|--------------------|
273
- | Blocked | Blocked due to client IP address | |
274
- | ContentError | Invalid format email | |
275
- | Delivered[1] | Successfully delivered | v4.16.0 |
276
- | ExceedLimit | Message size exceeded the limit(5.2.3) | |
277
- | Expired | Delivery time expired | |
278
- | Feedback | Bounced for a complaint of the message | |
279
- | Filtered | Rejected after DATA command | |
280
- | HasMoved | Destination mail addrees has moved | |
281
- | HostUnknown | Unknown destination host name | |
282
- | MailboxFull | Recipient's mailbox is full | |
283
- | MailerError | Mailer program error | |
284
- | MesgTooBig | Message size is too big(5.3.4) | |
285
- | NetworkError | Network error: DNS or routing | |
286
- | NotAccept | Destinaion does not accept any message | |
287
- | OnHold | Deciding the bounce reason is on hold | |
288
- | Rejected | Rejected due to envelope from address | |
289
- | NoRelaying | Relay access denied | |
290
- | SecurityError | Virus detected or authentication error | |
291
- | SpamDetected | Detected a message as spam | |
292
- | Suspend | Recipient's account is suspended | |
293
- | SyntaxError | syntax error in SMTP | v4.17.0 |
294
- | SystemError | Some error on the destination host | |
295
- | SystemFull | Disk full on the destination host | |
296
- | TooManyConn | Connection rate limit exceeded | |
297
- | UserUnknown | Recipient's address does not exist | |
298
- | Undefined | Could not decide the error reason | |
299
- | Vacation | Auto replied message | v4.1.28 |
300
-
301
- 1. This reason is not included by default
302
-
303
- Parsed data structure
304
- ---------------------
305
- The following table shows a data structure(`Sisimai::Data`) of parsed bounce mail.
306
- More details about data structure are available at available at
307
- [Sisimai | Data Structure of Sisimai::Data](http://libsisimai.org/en/data) page.
308
-
309
- | Name | Description |
310
- |----------------|-------------------------------------------------------------|
311
- | action | The value of Action: header |
312
- | addresser | The sender's email address (From:) |
313
- | alias | Alias of the recipient |
314
- | catch | Data returned from a hook mehotd |
315
- | destination | The domain part of the "recipinet" |
316
- | deliverystatus | Delivery Status(DSN), ex) 5.1.1, 4.4.7 |
317
- | diagnosticcode | Error message |
318
- | diagnostictype | Error message type |
319
- | feedbacktype | Feedback Type |
320
- | lhost | local host name(local MTA) |
321
- | listid | The value of List-Id: header of the original message |
322
- | messageid | The value of Message-Id: of the original message |
323
- | reason | Detected bounce reason |
324
- | recipient | Recipient address which bounced (To:) |
325
- | replycode | SMTP Reply Code, ex) 550, 421 |
326
- | rhost | Remote host name(remote MTA) |
327
- | senderdomain | The domain part of the "addresser" |
328
- | softbounce | The bounce is soft bounce or not: 0=hard,1=soft,-1=unknown |
329
- | smtpagent | MTA module name (Sisimai::MTA::, MSP::) |
330
- | smtpcommand | The last SMTP command in the session |
331
- | subject | The vale of Subject: header of the original message(UTF8) |
332
- | timestamp | Timestamp of the bounce, UNIX matchine time |
333
- | timezoneoffset | Time zone offset string: ex) +0900 |
334
- | token | MD5 value of addresser, recipient, and the timestamp |
253
+ Other specification of Sisimai
254
+ -------------------------------------------------------------------------------
255
+ - [**Parser Engines**](http://libsisimai.org/en/engine)
256
+ - [**Bounce Reason List**](http://libsisimai.org/en/reason)
257
+ - [**Data Structure of Sisimai::Data**](http://libsisimai.org/en/data)
258
+
259
+ Contributing
260
+ ===============================================================================
261
+
262
+ Bug report
263
+ -------------------------------------------------------------------------------
264
+ Please use the [issue tracker](https://github.com/sisimai/rb-Sisimai/issues)
265
+ to report any bugs.
335
266
 
336
267
  Emails could not be parsed
337
- --------------------------
338
- Bounce mails which could not be parsed by Sisimai are saved in the directory
339
- `set-of-emails/to-be-debugged-because/sisimai-cannot-parse-yet`. If you have
340
- found any bounce email cannot be parsed using Sisimai, please add the email
341
- into the directory and send Pull-Request to this repository.
268
+ -------------------------------------------------------------------------------
269
+ Bounce mails which could not be parsed by Sisimai are saved in the repository
270
+ [set-of-emails/to-be-debugged-because/sisimai-cannot-parse-yet](https://github.com/sisimai/set-of-emails/tree/master/to-be-debugged-because/sisimai-cannot-parse-yet).
271
+ If you have found any bounce email cannot be parsed using Sisimai, please add
272
+ the email into the directory and send Pull-Request to this repository.
342
273
 
343
274
  Other Information
344
- =================
275
+ ===============================================================================
276
+
345
277
  Related Sites
346
- -------------
278
+ -------------------------------------------------------------------------------
347
279
  * __@libsisimai__ | [Sisimai on Twitter (@libsisimai)](https://twitter.com/libsisimai)
348
- * __libsisimai.org__ | [Sisimai | The successor to bounceHammer, Library to parse bounce mails](http://libsisimai.org/)
280
+ * __libSISIMAI.ORG__ | [Sisimai | The successor to bounceHammer, Library to parse bounce mails](http://libsisimai.org/)
281
+ * __Sisimai Blog__ | [blog.libsisimai.org](http://blog.libsisimai.org/)
282
+ * __Facebook Page__ | [facebook.com/libsisimai](https://www.facebook.com/libsisimai/)
349
283
  * __GitHub__ | [github.com/sisimai/rb-Sisimai](https://github.com/sisimai/rb-Sisimai)
284
+ * __RubyGems.org__ | [rubygems.org/gems/sisimai](https://rubygems.org/gems/sisimai)
350
285
  * __Perl verson__ | [Perl version of Sisimai](https://github.com/sisimai/p5-Sisimai)
286
+ * __Fixtures__ | [set-of-emails - Sample emails for "make test"](https://github.com/sisimai/set-of-emails)
351
287
 
352
- SEE ALSO
353
- --------
288
+ See also
289
+ -------------------------------------------------------------------------------
354
290
  * [README-JA.md - README.md in Japanese(日本語)](https://github.com/sisimai/rb-Sisimai/blob/master/README-JA.md)
355
291
  * [RFC3463 - Enhanced Mail System Status Codes](https://tools.ietf.org/html/rfc3463)
356
292
  * [RFC3464 - An Extensible Message Format for Delivery Status Notifications](https://tools.ietf.org/html/rfc3464)
@@ -358,15 +294,15 @@ SEE ALSO
358
294
  * [RFC5321 - Simple Mail Transfer Protocol](https://tools.ietf.org/html/rfc5321)
359
295
  * [RFC5322 - Internet Message Format](https://tools.ietf.org/html/rfc5322)
360
296
 
361
- AUTHOR
362
- ------
297
+ Author
298
+ ===============================================================================
363
299
  [@azumakuniyuki](https://twitter.com/azumakuniyuki)
364
300
 
365
- COPYRIGHT
366
- ---------
367
- Copyright (C) 2015-2016 azumakuniyuki, All Rights Reserved.
301
+ Copyright
302
+ ===============================================================================
303
+ Copyright (C) 2015-2017 azumakuniyuki, All Rights Reserved.
368
304
 
369
- LICENSE
370
- -------
305
+ License
306
+ ===============================================================================
371
307
  This software is distributed under The BSD 2-Clause License.
372
308
 
Binary file
data/lib/sisimai.rb CHANGED
@@ -20,6 +20,7 @@ module Sisimai
20
20
  # @options argv1 [Boolean] delivered true: Include "delivered" reason
21
21
  # @options argv1 [Lambda] hook Lambda object to be called back
22
22
  # @options argv1 [String] input Input data format: 'email', 'json'
23
+ # @options argv1 [Array] field Email header name to be captured
23
24
  # @return [Array] Parsed objects
24
25
  # @return [nil] nil if the argument was wrong or an empty array
25
26
  def make(argv0, **argv1)
@@ -34,7 +35,7 @@ module Sisimai
34
35
  unless input
35
36
  # "input" did not specified, try to detect automatically.
36
37
  rtype = argv0.class.to_s
37
- if rtype == 'String'
38
+ if rtype == 'String' || rtype == 'IO'
38
39
  # The argument may be a path to email
39
40
  input = 'email'
40
41
 
@@ -47,6 +48,7 @@ module Sisimai
47
48
  methodargv = {}
48
49
  delivered1 = argv1[:delivered] || false
49
50
  hookmethod = argv1[:hook] || nil
51
+ headerlist = argv1[:field] || []
50
52
  bouncedata = []
51
53
 
52
54
  if input == 'email'
@@ -57,7 +59,7 @@ module Sisimai
57
59
 
58
60
  while r = mail.read do
59
61
  # Read and parse each mail file
60
- methodargv = { data: r, hook: hookmethod, input: 'email' }
62
+ methodargv = { data: r, hook: hookmethod, input: 'email', field: headerlist }
61
63
  mesg = Sisimai::Message.new(methodargv)
62
64
  next if mesg.void
63
65
 
@@ -99,7 +101,7 @@ module Sisimai
99
101
  fail ' ***error: invalid value of "input"'
100
102
  end
101
103
 
102
- return nil if bouncedata.size == 0
104
+ return nil if bouncedata.size.zero?
103
105
  return bouncedata
104
106
  end
105
107