sisimai 4.22.2 → 4.22.3

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 (86) hide show
  1. checksums.yaml +4 -4
  2. data/ANALYTICAL-PRECISION +24 -23
  3. data/ChangeLog.md +39 -2
  4. data/README-JA.md +10 -10
  5. data/README.md +10 -10
  6. data/lib/sisimai.rb +0 -1
  7. data/lib/sisimai/bite/email.rb +1 -1
  8. data/lib/sisimai/bite/email/amazonses.rb +1 -2
  9. data/lib/sisimai/bite/email/exim.rb +46 -8
  10. data/lib/sisimai/bite/email/fml.rb +170 -0
  11. data/lib/sisimai/bite/email/imailserver.rb +1 -1
  12. data/lib/sisimai/bite/email/messagelabs.rb +6 -1
  13. data/lib/sisimai/bite/email/office365.rb +0 -1
  14. data/lib/sisimai/data.rb +34 -12
  15. data/lib/sisimai/datetime.rb +10 -4
  16. data/lib/sisimai/reason.rb +70 -55
  17. data/lib/sisimai/reason/blocked.rb +91 -21
  18. data/lib/sisimai/reason/expired.rb +7 -3
  19. data/lib/sisimai/reason/filtered.rb +1 -0
  20. data/lib/sisimai/reason/hostunknown.rb +9 -5
  21. data/lib/sisimai/reason/mailboxfull.rb +17 -9
  22. data/lib/sisimai/reason/mailererror.rb +5 -4
  23. data/lib/sisimai/reason/mesgtoobig.rb +2 -0
  24. data/lib/sisimai/reason/networkerror.rb +11 -3
  25. data/lib/sisimai/reason/norelaying.rb +5 -2
  26. data/lib/sisimai/reason/policyviolation.rb +9 -2
  27. data/lib/sisimai/reason/rejected.rb +41 -10
  28. data/lib/sisimai/reason/securityerror.rb +2 -0
  29. data/lib/sisimai/reason/spamdetected.rb +37 -20
  30. data/lib/sisimai/reason/suspend.rb +10 -4
  31. data/lib/sisimai/reason/systemerror.rb +1 -0
  32. data/lib/sisimai/reason/toomanyconn.rb +4 -0
  33. data/lib/sisimai/reason/userunknown.rb +40 -20
  34. data/lib/sisimai/reason/vacation.rb +20 -1
  35. data/lib/sisimai/reason/virusdetected.rb +3 -1
  36. data/lib/sisimai/rfc3464.rb +3 -4
  37. data/lib/sisimai/rfc3834.rb +37 -6
  38. data/lib/sisimai/rhost.rb +2 -1
  39. data/lib/sisimai/rhost/exchangeonline.rb +29 -0
  40. data/lib/sisimai/rhost/franceptt.rb +58 -0
  41. data/lib/sisimai/smtp/status.rb +1 -0
  42. data/lib/sisimai/version.rb +1 -1
  43. data/set-of-emails/jsonobj/json-amazonses-06.json +1 -0
  44. data/set-of-emails/maildir/bsd/email-exim-31.eml +39 -0
  45. data/set-of-emails/maildir/bsd/email-exim-32.eml +42 -0
  46. data/set-of-emails/maildir/bsd/email-exim-33.eml +42 -0
  47. data/set-of-emails/maildir/bsd/email-exim-34.eml +41 -0
  48. data/set-of-emails/maildir/bsd/email-exim-35.eml +41 -0
  49. data/set-of-emails/maildir/bsd/email-exim-36.eml +41 -0
  50. data/set-of-emails/maildir/bsd/email-exim-37.eml +41 -0
  51. data/set-of-emails/maildir/bsd/email-exim-38.eml +32 -0
  52. data/set-of-emails/maildir/bsd/email-exim-39.eml +47 -0
  53. data/set-of-emails/maildir/bsd/email-exim-40.eml +41 -0
  54. data/set-of-emails/maildir/bsd/email-exim-41.eml +32 -0
  55. data/set-of-emails/maildir/bsd/email-exim-42.eml +41 -0
  56. data/set-of-emails/maildir/bsd/email-exim-43.eml +60 -0
  57. data/set-of-emails/maildir/bsd/email-exim-44.eml +64 -0
  58. data/set-of-emails/maildir/bsd/email-exim-45.eml +43 -0
  59. data/set-of-emails/maildir/bsd/email-exim-46.eml +41 -0
  60. data/set-of-emails/maildir/bsd/email-exim-47.eml +42 -0
  61. data/set-of-emails/maildir/bsd/email-exim-48.eml +59 -0
  62. data/set-of-emails/maildir/bsd/email-exim-49.eml +59 -0
  63. data/set-of-emails/maildir/bsd/email-exim-50.eml +41 -0
  64. data/set-of-emails/maildir/bsd/email-exim-51.eml +41 -0
  65. data/set-of-emails/maildir/bsd/email-exim-52.eml +34 -0
  66. data/set-of-emails/maildir/bsd/email-exim-53.eml +48 -0
  67. data/set-of-emails/maildir/bsd/email-exim-54.eml +40 -0
  68. data/set-of-emails/maildir/bsd/email-exim-55.eml +38 -0
  69. data/set-of-emails/maildir/bsd/email-exim-56.eml +40 -0
  70. data/set-of-emails/maildir/bsd/email-exim-57.eml +39 -0
  71. data/set-of-emails/maildir/bsd/email-exim-58.eml +43 -0
  72. data/set-of-emails/maildir/bsd/email-fml-01.eml +70 -0
  73. data/set-of-emails/maildir/bsd/email-fml-02.eml +44 -0
  74. data/set-of-emails/maildir/bsd/email-office365-03.eml +117 -0
  75. data/set-of-emails/maildir/bsd/email-postfix-31.eml +94 -0
  76. data/set-of-emails/maildir/bsd/email-sendmail-45.eml +102 -0
  77. data/set-of-emails/maildir/bsd/email-sendmail-46.eml +103 -0
  78. data/set-of-emails/maildir/bsd/email-sendmail-47.eml +102 -0
  79. data/set-of-emails/maildir/bsd/email-sendmail-48.eml +101 -0
  80. data/set-of-emails/maildir/bsd/rfc3464-33.eml +38 -0
  81. data/set-of-emails/maildir/bsd/rfc3464-34.eml +53 -0
  82. data/set-of-emails/maildir/bsd/rhost-exchange-online-02.eml +89 -0
  83. data/set-of-emails/maildir/bsd/rhost-exchange-online-03.eml +205 -0
  84. data/set-of-emails/maildir/bsd/rhost-franceptt-01.eml +102 -0
  85. data/set-of-emails/maildir/bsd/rhost-franceptt-02.eml +103 -0
  86. metadata +47 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ca3f22af3e372dd9c1d741bca61752dc92bdeaf
4
- data.tar.gz: bf25002aabb9a2926ca13631022b06b6331271f9
3
+ metadata.gz: 070cf8352a34c7b1e1a3edf5a5314edd4055f42c
4
+ data.tar.gz: 7de43603e7ff8f2389837c5348a73da80a3be66a
5
5
  SHA512:
6
- metadata.gz: 440afa6405f3c4b7e0faa47c958733e755f8400dd9666b3e324dedea6b8d01d506be83b3115332fc1b0ac8f83bab029a68f13ee7c2969df2392a90af0338d960
7
- data.tar.gz: 44effc61e68e42a4dc9a1f71c95daacaf61d5e6f0904cf57b0b1a405621fd5fafeca99195f76c88398974093d74a038e5243ecbaf6718d143b4f8650fd61966c
6
+ metadata.gz: 6bd270023eb979e241549a0c00750e11fea7eb49c0f11e84e7ef608a954f4fd1ac6cbc5a6741ae19a885868fd0b3d6dee17fd17e392e50878d8e5e04a6a2f569
7
+ data.tar.gz: 1bf3aa04dc06a099b462fd63696fc8d1013791d0a110deb82d9fa6be0cf6a3a64be93d849c947deb87da730775893a70c611344c202d0c8bb6448b5f9c349577
data/ANALYTICAL-PRECISION CHANGED
@@ -2,59 +2,60 @@
2
2
  MTA MODULE NAME CAN PARSE RATIO NOTES
3
3
  --------------------------------------------------------------------------------
4
4
  Email::Activehunter ..... 0/0014 0.0000 TransWARE Active!hunter
5
- Email::AmazonSES ........ 22/0031 0.7097 Amazon SES(Sending): http://aws.amazon.com/ses/
5
+ Email::AmazonSES ........ 31/0040 0.7750 Amazon SES(Sending): http://aws.amazon.com/ses/
6
6
  Email::AmazonWorkMail ... 8/0012 0.6667 Amazon WorkMail: https://aws.amazon.com/workmail/
7
7
  Email::Aol .............. 20/0023 0.8696 Aol Mail: http://www.aol.com
8
8
  Email::ApacheJames ...... 0/0006 0.0000 Java Apache Mail Enterprise Server
9
9
  Email::Bigfoot .......... 2/0002 1.0000 Bigfoot: http://www.bigfoot.com
10
10
  Email::Biglobe .......... 5/0007 0.7143 BIGLOBE: http://www.biglobe.ne.jp
11
11
  Email::Courier .......... 14/0016 0.8750 Courier MTA
12
- Email::Domino ........... 6/0015 0.4000 IBM Domino Server
13
- Email::EZweb ............ 130/0125 1.0000 au EZweb: http://www.au.kddi.com/mobile/
12
+ Email::Domino ........... 6/0016 0.3750 IBM Domino Server
13
+ Email::EZweb ............ 130/0123 1.0000 au EZweb: http://www.au.kddi.com/mobile/
14
14
  Email::EinsUndEins ...... 0/0003 0.0000 1&1: http://www.1and1.de
15
15
  Email::Exchange2003 ..... 1/0051 0.0196 Microsoft Exchange Server 2003
16
- Email::Exchange2007 ..... 6/0007 0.8571 Microsoft Exchange Server 2007
17
- Email::Exim ............. 146/0176 0.8295 Exim
16
+ Email::Exchange2007 ..... 6/0009 0.6667 Microsoft Exchange Server 2007
17
+ Email::Exim ............. 226/0285 0.7930 Exim
18
+ Email::FML .............. 0/0004 0.0000 fml mailing list server/manager
18
19
  Email::Facebook ......... 3/0003 1.0000 Facebook: https://www.facebook.com
19
20
  Email::GMX .............. 0/0010 0.0000 GMX: http://www.gmx.net
20
- Email::GSuite ........... 9/0009 1.0000 G Suite: https://gsuite.google.com/
21
+ Email::GSuite ........... 10/0010 1.0000 G Suite: https://gsuite.google.com/
21
22
  Email::Google ........... 58/0062 0.9355 Google Gmail: https://mail.google.com
22
- Email::IMailServer ...... 0/0045 0.0000 IPSWITCH IMail Server
23
+ Email::IMailServer ...... 0/0023 0.0000 IPSWITCH IMail Server
23
24
  Email::InterScanMSS ..... 0/0009 0.0000 Trend Micro InterScan Messaging Security Suite
24
25
  Email::KDDI ............. 6/0006 1.0000 au by KDDI: http://www.au.kddi.com
25
26
  Email::MXLogic .......... 0/0014 0.0000 McAfee SaaS
26
27
  Email::MailFoundry ...... 0/0007 0.0000 MailFoundry
27
28
  Email::MailMarshalSMTP .. 0/0003 0.0000 Trustwave Secure Email Gateway
28
29
  Email::MailRu ........... 4/0016 0.2500 @mail.ru: https://mail.ru
29
- Email::McAfee ........... 0/0010 0.0000 McAfee Email Appliance
30
- Email::MessageLabs ...... 2/0002 1.0000 Symantec.cloud http://www.messagelabs.com
31
- Email::MessagingServer .. 19/0022 0.8636 Oracle Communications Messaging Server
32
- Email::Notes ............ 0/0012 0.0000 Lotus Notes
33
- Email::Office365 ........ 8/0011 0.7273 Microsoft Office 365: http://office.microsoft.com/
30
+ Email::McAfee ........... 0/0011 0.0000 McAfee Email Appliance
31
+ Email::MessageLabs ...... 4/0004 1.0000 Symantec.cloud http://www.messagelabs.com
32
+ Email::MessagingServer .. 20/0023 0.8696 Oracle Communications Messaging Server
33
+ Email::Notes ............ 0/0013 0.0000 Lotus Notes
34
+ Email::Office365 ........ 10/0013 0.7692 Microsoft Office 365: http://office.microsoft.com/
34
35
  Email::OpenSMTPD ........ 6/0024 0.2500 OpenSMTPD
35
36
  Email::Outlook .......... 19/0021 0.9048 Microsoft Outlook.com: https://www.outlook.com/
36
- Email::Postfix .......... 175/0193 0.9067 Postfix
37
+ Email::Postfix .......... 203/0222 0.9144 Postfix
37
38
  Email::ReceivingSES ..... 0/0007 0.0000 Amazon SES(Receiving): http://aws.amazon.com/ses/
38
39
  Email::SendGrid ......... 7/0012 0.5833 SendGrid: http://sendgrid.com/
39
- Email::Sendmail ......... 334/0257 1.0000 V8Sendmail: /usr/sbin/sendmail
40
+ Email::Sendmail ......... 338/0262 1.0000 V8Sendmail: /usr/sbin/sendmail
40
41
  Email::SurfControl ...... 6/0008 0.7500 WebSense SurfControl
41
42
  Email::V5sendmail ....... 0/0386 0.0000 Sendmail version 5
42
43
  Email::Verizon .......... 4/0004 1.0000 Verizon Wireless: http://www.verizonwireless.com
43
44
  Email::X1 ............... 0/0007 0.0000 Unknown MTA #1
44
45
  Email::X2 ............... 0/0069 0.0000 Unknown MTA #2
45
46
  Email::X3 ............... 0/0012 0.0000 Unknown MTA #3
46
- Email::X4 ............... 0/0029 0.0000 Unknown MTA #4 qmail clones
47
+ Email::X4 ............... 0/0030 0.0000 Unknown MTA #4 qmail clones
47
48
  Email::X5 ............... 3/0003 1.0000 Unknown MTA #5
48
- Email::Yahoo ............ 0/0009 0.0000 Yahoo! MAIL: https://www.yahoo.com
49
+ Email::Yahoo ............ 0/0010 0.0000 Yahoo! MAIL: https://www.yahoo.com
49
50
  Email::Yandex ........... 4/0007 0.5714 Yandex.Mail: http://www.yandex.ru
50
51
  Email::Zoho ............. 0/0011 0.0000 Zoho Mail: https://www.zoho.com
51
- Email::MFILTER .......... 0/0009 0.0000 Digital Arts m-FILTER
52
- Email::Qmail ............ 53/0082 0.6463 qmail
53
- JSON::AmazonSES ......... 22/0031 0.7097 Amazon SES(JSON): http://aws.amazon.com/ses/
52
+ Email::mFILTER .......... 0/0009 0.0000 Digital Arts m-FILTER
53
+ Email::qmail ............ 55/0085 0.6471 qmail
54
+ JSON::AmazonSES ......... 31/0040 0.7750 Amazon SES(JSON): http://aws.amazon.com/ses/
54
55
  JSON::SendGrid .......... 7/0012 0.5833 SendGrid(JSON): http://sendgrid.com/
55
56
  ARF ..................... 9/0050 0.1800 Abuse Feedback Reporting Format
56
- RFC3464 ................. 136/0280 0.4857 Fallback Module for MTAs
57
- RFC3834 ................. 0/0007 0.0000 Detector for auto replied message
57
+ RFC3464 ................. 145/0296 0.4899 Fallback Module for MTAs
58
+ RFC3834 ................. 0/0012 0.0000 Detector for auto replied message
58
59
  --------------------------------------------------------------------------------
59
- bounceHammer 2.7.13p3 1254/2259 0.5551
60
- Sisimai 4.22.0 2259/2259 1.0000
60
+ bounceHammer 2.7.13p3 1401/2437 0.5749
61
+ Sisimai 4.22.3 2437/2437 1.0000
data/ChangeLog.md CHANGED
@@ -3,14 +3,51 @@ 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.22.3
7
+ --------------------------------------------------------------------------------
8
+ - release: "Tue, 26 Dec 2017 09:22:22 +0900 (JST)"
9
+ - version: "4.22.3"
10
+ - changes:
11
+ - Issue #88: Fix codes in Sisimai.DateTime.parse() for setting numeric values
12
+ using sprintf(). Thanks to @phuong1492.
13
+ - Import Pull-Request sisimai/p5-Sisimai#239, add error message patterns for
14
+ laposte.net and orange.fr.
15
+ - Import Pull-Req sisimai/p5-Sisimai#244 to follow up sisimai/p5-Sisimai#239.
16
+ More support for Orange and La Poste.
17
+ - Import Pull-Request sisimai/p5-Sisimai#245, update error message patterns
18
+ of SFR and Free.fr.
19
+ - Import Pull-Request sisimai/p5-Sisimai#246, large scale updates for Exim
20
+ and error message patterns.
21
+ - Merge Pull-Request #93 from @subuta to fix issue #92. Sisimai.make() method
22
+ passes ActiveSupport::HashWithIndifferentAccess object with `input: "json"`
23
+ parameter. Thanks to @subuta.
24
+ - Import Pull-Request sisimai/p5-Sisimai#247, Add 100+ error message patterns
25
+ into the following reason classes: Blocked, Expired, Filtered, HostUnknown,
26
+ PolicyViolation, MailboxFull, NetworkError, NoRelaying, Rejected, Suspend,
27
+ SpamDetected, SystemError, TooManyConn, and UserUnknown.
28
+ - Fix bug in a regular expression object for concatenating error messages in
29
+ Sisimai::Bite::Email::Exim.
30
+ - Fix a wrong regular expression for detecting a recipient address and error
31
+ messages in Sisiamai::Bite::Email::IMailServer.
32
+ - Import Pull-Request sisimai/p5-Sisimai#247: Improved code at Sisimai::Data
33
+ to remove string like "550-5.1.1" from an error message for to be matched
34
+ exactly with regular expressions defined in each class of Sisimai::Reason.
35
+ - Fixed issue #91, Import and convert error messages and reasons table from
36
+ Sisimai::Bite::Email::Exchange2007 into Sisimai::Rhost::ExchangeOnline for
37
+ detecting an error reason. Thanks to @joaoscotto.
38
+ - Fix code to avoid an error with "invalid byte sequence in UTF-8" reported
39
+ at https://heartbeats.jp/hbblog/2017/12/sisimai.html .
40
+ - Implement Sisimai::Bite::Email::FML to parse bounce mails generated by fml
41
+ mailing list server/manager. Thanks to @ttkzw.
42
+
6
43
  v4.22.2
7
44
  --------------------------------------------------------------------------------
8
45
  - release: "Fri, 13 Oct 2017 11:59:53 +0900 (JST)"
9
- - version: "v4.22.2"
46
+ - version: "4.22.2"
10
47
  - changes:
11
48
  - Apply Pull-Request #84 (issue #83) for setting the value of `softorhard` in
12
49
  `Sisimai::SMTP::Error.soft_or_hard` method. Thanks to @lunatyq.
13
- - Fix a wrong value assingment, and code for Performance/StartWith reported
50
+ - Fix a wrong value assignment, and code for Performance/StartWith reported
14
51
  from Rubocop in Sisimai::Bite::Email::GSuite.
15
52
  - Update codes about Lint/AssignmentInCondition, Style/Next, Style/EmptyElse,
16
53
  Style/UselessAssignment, and others reported from Rubocop.
data/README-JA.md CHANGED
@@ -54,7 +54,7 @@ Key features
54
54
  * git clone & make
55
55
  * __高い解析精度__
56
56
  * 解析精度はbounceHammerの2倍
57
- * 27種類のMTAに対応
57
+ * 28種類のMTAに対応
58
58
  * 22種類の著名なMSPに対応
59
59
  * 2種類の著名なメール配信クラウドに対応(JSON)
60
60
  * Feedback Loopにも対応
@@ -80,10 +80,10 @@ Install
80
80
 
81
81
  ```shell
82
82
  $ sudo gem install sisimai
83
- Fetching: sisimai-4.22.0.gem (100%)
84
- Successfully installed sisimai-4.22.0
85
- Parsing documentation for sisimai-4.22.0
86
- Installing ri documentation for sisimai-4.22.0
83
+ Fetching: sisimai-4.22.2.gem (100%)
84
+ Successfully installed sisimai-4.22.2
85
+ Parsing documentation for sisimai-4.22.2
86
+ Installing ri documentation for sisimai-4.22.2
87
87
  Done installing documentation for sisimai after 6 seconds
88
88
  1 gem installed
89
89
  ```
@@ -99,8 +99,8 @@ gem install bundle rake rspec coveralls
99
99
  ...
100
100
  4 gems installed
101
101
  bundle exec rake install
102
- sisimai 4.22.0 built to pkg/sisimai-4.22.0.gem.
103
- sisimai (4.22.0) installed.
102
+ sisimai 4.22.2 built to pkg/sisimai-4.22.2.gem.
103
+ sisimai (4.22.2) installed.
104
104
  ```
105
105
 
106
106
  Usage
@@ -236,11 +236,11 @@ Differences between Ruby version and Perl version
236
236
  | 動作環境 | Ruby 2.1 - 2.4 | Perl 5.10 - |
237
237
  | | JRuby 9.0.4.0- | |
238
238
  | 解析精度の割合(2000通のメール)[1] | 1.00 | 1.00 |
239
- | メール解析速度(1000通のメール) | 3.30秒 | 2.33秒 |
239
+ | メール解析速度(1000通のメール) | 6.70秒 | 2.10秒 |
240
240
  | インストール方法 | gem install | cpanm, cpm |
241
241
  | 依存モジュール数(コアモジュールを除く) | 1モジュール | 2モジュール |
242
- | LOC:ソースコードの行数 | 12600行 | 9400行 |
243
- | テスト件数(spec/,t/,xt/ディレクトリ) | 197300件 | 205200件 |
242
+ | LOC:ソースコードの行数 | 13000行 | 9800行 |
243
+ | テスト件数(spec/,t/,xt/ディレクトリ) | 213000件 | 230000件 |
244
244
  | ライセンス | 二条項BSD | 二条項BSD |
245
245
  | 開発会社によるサポート契約 | 準備中 | 提供中 |
246
246
 
data/README.md CHANGED
@@ -53,7 +53,7 @@ Key Features
53
53
  * git clone & make
54
54
  * __High Precision of Analysis__
55
55
  * 2 times higher than bounceHammer
56
- * Support 22 known MTAs and 5 unknown MTAs
56
+ * Support 23 known MTAs and 5 unknown MTAs
57
57
  * Support 22 major MSPs(Mail Service Providers)
58
58
  * Support 2 major Cloud Email Delivery Services(JSON format)
59
59
  * Support Feedback Loop Message(ARF)
@@ -85,10 +85,10 @@ Install
85
85
 
86
86
  ```shell
87
87
  $ sudo gem install sisimai
88
- Fetching: sisimai-4.22.0.gem (100%)
89
- Successfully installed sisimai-4.22.0
90
- Parsing documentation for sisimai-4.22.0
91
- Installing ri documentation for sisimai-4.22.0
88
+ Fetching: sisimai-4.22.2.gem (100%)
89
+ Successfully installed sisimai-4.22.2
90
+ Parsing documentation for sisimai-4.22.2
91
+ Installing ri documentation for sisimai-4.22.2
92
92
  Done installing documentation for sisimai after 6 seconds
93
93
  1 gem installed
94
94
  ```
@@ -104,8 +104,8 @@ gem install bundle rake rspec coveralls
104
104
  ...
105
105
  4 gems installed
106
106
  bundle exec rake install
107
- sisimai 4.22.0 built to pkg/sisimai-4.22.0.gem.
108
- sisimai (4.22.0) installed.
107
+ sisimai 4.22.2 built to pkg/sisimai-4.22.2.gem.
108
+ sisimai (4.22.2) installed.
109
109
  ```
110
110
 
111
111
  Usage
@@ -240,11 +240,11 @@ and bounceHammer are available at
240
240
  | System requirements | Ruby 2.1 - 2.4 | Perl 5.10 - |
241
241
  | | JRuby 9.0.4.0- | |
242
242
  | Analytical precision ratio(2000 emails)[1] | 1.00 | 1.00 |
243
- | The speed of parsing email(1000 emails) | 3.30s | 2.33s |
243
+ | The speed of parsing email(1000 emails) | 6.70s | 2.10s |
244
244
  | How to install | gem install | cpanm, cpm |
245
245
  | Dependencies (Except core modules) | 1 module | 2 modules |
246
- | LOC:Source lines of code | 12600 lines | 9400 lines |
247
- | The number of tests(spec/,t/,xt/) directory | 197300 tests | 205200 tests |
246
+ | LOC:Source lines of code | 13000 lines | 9800 lines |
247
+ | The number of tests(spec/,t/,xt/) directory | 213000 tests | 230000 tests |
248
248
  | License | BSD 2-Clause | BSD 2-Clause |
249
249
  | Support Contract provided by Developer | Coming soon | Available |
250
250
 
data/lib/sisimai.rb CHANGED
@@ -78,7 +78,6 @@ module Sisimai
78
78
  if type == 'Array'
79
79
  # [ {...}, {...}, ... ]
80
80
  argv0.each do |e|
81
- next unless e.class.to_s == 'Hash'
82
81
  list << e
83
82
  end
84
83
  else
@@ -28,7 +28,7 @@ module Sisimai
28
28
  GMX Bigfoot Facebook Zoho EinsUndEins MessageLabs EZweb KDDI Biglobe
29
29
  ApacheJames McAfee MXLogic MailFoundry IMailServer
30
30
  MFILTER Activehunter InterScanMSS SurfControl MailMarshalSMTP
31
- X1 X2 X3 X4 X5 V5sendmail
31
+ X1 X2 X3 X4 X5 V5sendmail FML
32
32
  |
33
33
  end
34
34
 
@@ -209,6 +209,7 @@ module Sisimai::Bite::Email
209
209
  # Set default values if each value is empty.
210
210
  connheader.each_key { |a| e[a] ||= connheader[a] || '' }
211
211
 
212
+ e['agent'] = self.smtpagent
212
213
  e['diagnosis'] ||= ''
213
214
  e['diagnosis'] = e['diagnosis'].gsub(/\\n/, ' ')
214
215
  e['diagnosis'] = Sisimai::String.sweep(e['diagnosis'])
@@ -233,8 +234,6 @@ module Sisimai::Bite::Email
233
234
  break
234
235
  end
235
236
 
236
- e['reason'] ||= Sisimai::SMTP::Status.name(e['status'])
237
- e['agent'] = self.smtpagent
238
237
  end
239
238
 
240
239
  rfc822part = Sisimai::RFC5322.weedout(rfc822list)
@@ -50,13 +50,14 @@ module Sisimai::Bite::Email
50
50
  :alias => %r/\A([ ]+an[ ]undisclosed[ ]address)\z/,
51
51
  :frozen => %r/\AMessage .+ (?:has been frozen|was frozen on arrival)/,
52
52
  :rfc822 => %r{\A(?:
53
- [-]+[ ]This[ ]is[ ]a[ ]copy[ ]of[ ]the[ ]message.+headers[.][ ][-]+
53
+ [-]+[ ]This[ ]is[ ]a[ ]copy[ ]of[ ](?:the|your)[ ]message.+headers[.][ ][-]+
54
54
  |Content-Type:[ ]*message/rfc822
55
55
  )\z
56
56
  }x,
57
57
  :begin => %r{\A(?>
58
58
  This[ ]message[ ]was[ ]created[ ]automatically[ ]by[ ]mail[ ]delivery[ ]software[.]
59
59
  |A[ ]message[ ]that[ ]you[ ]sent[ ]was[ ]rejected[ ]by[ ]the[ ]local[ ]scanning[ ]code
60
+ |A[ ]message[ ]that[ ]you[ ]sent[ ]contained[ ]one[ ]or[ ]more[ ]recipient[ ]addresses[ ]
60
61
  |Message[ ].+[ ](?:has[ ]been[ ]frozen|was[ ]frozen[ ]on[ ]arrival)
61
62
  |The[ ].+[ ]router[ ]encountered[ ]the[ ]following[ ]error[(]s[)]:
62
63
  )
@@ -100,6 +101,17 @@ module Sisimai::Bite::Email
100
101
  |no[ ]host[ ]found[ ]for[ ]existing[ ]SMTP[ ]connection
101
102
  )
102
103
  }x,
104
+ # parser.c:666| *errorptr = string_sprintf("%s (expected word or \"<\")", *errorptr);
105
+ # parser.c:701| if(bracket_count++ > 5) FAILED(US"angle-brackets nested too deep");
106
+ # parser.c:738| FAILED(US"domain missing in source-routed address");
107
+ # parser.c:747| : string_sprintf("malformed address: %.32s may not follow %.*s",
108
+ syntaxerror: %r{(?:
109
+ angle-brackets[ ]nested[ ]too[ ]deep
110
+ |expected[ ]word[ ]or[ ]["]<["]
111
+ |domain[ ]missing[ ]in[ ]source-routed[ ]address
112
+ |malformed[ ]address:
113
+ )
114
+ }x,
103
115
  # deliver.c:5614| addr->message = US"delivery to file forbidden";
104
116
  # deliver.c:5624| addr->message = US"delivery to pipe forbidden";
105
117
  # transports/pipe.c:1156| addr->user_message = US"local delivery failed";
@@ -219,19 +231,38 @@ module Sisimai::Bite::Email
219
231
  # host neko.example.jp [192.0.2.222]: 550 5.1.1 <kijitora@example.jp>... User Unknown
220
232
  v = dscontents[-1]
221
233
 
222
- if cv = e.match(/\A[ ][ ]+([^ \t]+[@][^ \t]+[.][a-zA-Z]+)(:.+)?\z/) || e.match(Re1[:alias])
234
+ if cv = e.match(/\A[ \t]{2}([^ \t]+[@][^ \t]+[.]?[a-zA-Z]+)(:.+)?\z/) ||
235
+ e.match(/\A[ \t]{2}[^ \t]+[@][^ \t]+[.][a-zA-Z]+[ ]<(.+?[@].+?)>:.+\z/) ||
236
+ e.match(Re1[:alias])
223
237
  # kijitora@example.jp
224
238
  # sabineko@example.jp: forced freeze
239
+ # mikeneko@example.jp <nekochan@example.org>: ...
225
240
  #
226
241
  # deliver.c:4549| printed = US"an undisclosed address";
227
242
  # an undisclosed address
228
243
  # (generated from kijitora@example.jp)
244
+ r = cv[1]
245
+
229
246
  if v['recipient']
230
247
  # There are multiple recipient addresses in the message body.
231
248
  dscontents << Sisimai::Bite.DELIVERYSTATUS
232
249
  v = dscontents[-1]
233
250
  end
234
- v['recipient'] = cv[1]
251
+ # v['recipient'] = cv[1]
252
+
253
+ if cv = e.match(/\A[ \t]+[^ \t]+[@][^ \t]+[.][a-zA-Z]+[ ]<(.+?[@].+?)>:.+\z/)
254
+ # parser.c:743| while (bracket_count-- > 0) if (*s++ != '>')
255
+ # parser.c:744| {
256
+ # parser.c:745| *errorptr = s[-1] == 0
257
+ # parser.c:746| ? US"'>' missing at end of address"
258
+ # parser.c:747| : string_sprintf("malformed address: %.32s may not follow %.*s",
259
+ # parser.c:748| s-1, (int)(s - US mailbox - 1), mailbox);
260
+ # parser.c:749| goto PARSE_FAILED;
261
+ # parser.c:750| }
262
+ r = cv[1]
263
+ v['diagnosis'] = e
264
+ end
265
+ v['recipient'] = r
235
266
  recipients += 1
236
267
 
237
268
  elsif cv = e.match(/\A[ ]+[(]generated[ ]from[ ](.+)[)]\z/) ||
@@ -295,9 +326,16 @@ module Sisimai::Bite::Email
295
326
  else
296
327
  # Error message when email address above does not include '@'
297
328
  # and domain part.
298
- next unless e =~ /\A[ ]{4}/
299
- v['alterrors'] ||= ''
300
- v['alterrors'] += e + ' '
329
+ if e =~ %r<\A[ ]+pipe[ ]to[ ][|]/.+>
330
+ # pipe to |/path/to/prog ...
331
+ # generated by kijitora@example.com
332
+ v['diagnosis'] = e
333
+ else
334
+ next unless e =~ /\A[ ]{4}/
335
+ v['alterrors'] ||= ''
336
+ v['alterrors'] += e + ' '
337
+ end
338
+
301
339
  end
302
340
  end
303
341
  end
@@ -384,7 +422,7 @@ module Sisimai::Bite::Email
384
422
  if e['alterrors'] && e['alterrors'].size > 0
385
423
  # Copy alternative error message
386
424
  if e['diagnosis'].nil? || e['diagnosis'].empty?
387
- e['diagnosis'] ||= e['alterrors']
425
+ e['diagnosis'] = e['alterrors']
388
426
  end
389
427
 
390
428
  if e['diagnosis'] =~ /\A[-]+/ || e['diagnosis'].end_with?('__')
@@ -395,7 +433,7 @@ module Sisimai::Bite::Email
395
433
  # Check the both value and try to match
396
434
  if e['diagnosis'].size < e['alterrors'].size
397
435
  # Check the value of alterrors
398
- rxdiagnosis = %r/#{e['diagnosis']}/i
436
+ rxdiagnosis = %r/e['diagnosis']/i
399
437
  if e['alterrors'] =~ rxdiagnosis
400
438
  # Override the value of diagnostic code message because
401
439
  # the value of alterrors includes the value of diagnosis.
@@ -0,0 +1,170 @@
1
+ module Sisimai::Bite::Email
2
+ # Sisimai::Bite::Email::FML parses a bounce email which created by fml.
3
+ # Methods in the module are called from only Sisimai::Message.
4
+ module FML
5
+ class << self
6
+ # Imported from p5-Sisimail/lib/Sisimai/Bite/Email/FML.pm
7
+ require 'sisimai/bite/email'
8
+
9
+ Re0 = {
10
+ :'from' => %r/.+[-]admin[@].+/,
11
+ :'message-id' => %r/\A[<]\d+[.]FML.+[@].+[>]\z/,
12
+ }.freeze
13
+ Re1 = {
14
+ :rfc822 => %r/\AOriginal[ ]mail[ ]as[ ]follows:\z/,
15
+ :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
16
+ }.freeze
17
+ ErrorTitle = {
18
+ :rejected => %r{(?>
19
+ (?:Ignored[ ])*NOT[ ]MEMBER[ ]article[ ]from[ ]
20
+ |reject[ ]mail[ ](?:.+:|from)[ ],
21
+ |Spam[ ]mail[ ]from[ ]a[ ]spammer[ ]is[ ]rejected
22
+ |You[ ].+[ ]are[ ]not[ ]member
23
+ )
24
+ }x,
25
+ :systemerror => %r{(?:
26
+ fml[ ]system[ ]error[ ]message
27
+ |Loop[ ]Alert:[ ]
28
+ |Loop[ ]Back[ ]Warning:[ ]
29
+ |WARNING:[ ]UNIX[ ]FROM[ ]Loop
30
+ )
31
+ }x,
32
+ :securityerror => %r/Security[ ]Alert/,
33
+ }.freeze
34
+ ErrorTable = {
35
+ :rejected => %r{(?>
36
+ (?:Ignored[ ])*NOT[ ]MEMBER[ ]article[ ]from[ ]
37
+ |reject[ ](?:
38
+ mail[ ]from[ ].+[@].+
39
+ |since[ ].+[ ]header[ ]may[ ]cause[ ]mail[ ]loop
40
+ |spammers:
41
+ )
42
+ |You[ ]are[ ]not[ ]a[ ]member[ ]of[ ]this[ ]mailing[ ]list
43
+ )
44
+ }x,
45
+ :systemerror => %r{(?:
46
+ Duplicated[ ]Message-ID
47
+ |fml[ ].+[ ]has[ ]detected[ ]a[ ]loop[ ]condition[ ]so[ ]that
48
+ |Loop[ ]Back[ ]Warning:
49
+ )
50
+ }x,
51
+ :securityerror => %r/Security[ ]alert:/,
52
+ }.freeze
53
+ Indicators = Sisimai::Bite::Email.INDICATORS
54
+
55
+ def description; return 'fml mailing list server/manager'; end
56
+ def smtpagent; return Sisimai::Bite.smtpagent(self); end
57
+ def headerlist; return ['X-MLServer']; end
58
+ def pattern; return Re0; end
59
+
60
+ # Parse bounce messages from fml mailling list server/manager
61
+ # @param [Hash] mhead Message headers of a bounce email
62
+ # @options mhead [String] from From header
63
+ # @options mhead [String] date Date header
64
+ # @options mhead [String] subject Subject header
65
+ # @options mhead [Array] received Received headers
66
+ # @options mhead [String] others Other required headers
67
+ # @param [String] mbody Message body of a bounce email
68
+ # @return [Hash, Nil] Bounce data list and message/rfc822
69
+ # part or nil if it failed to parse or
70
+ # the arguments are missing
71
+ def scan(mhead, mbody)
72
+ return nil unless mhead
73
+ return nil unless mbody
74
+ return nil unless mhead['x-mlserver']
75
+ return nil unless mhead['from'] =~ Re0[:from]
76
+ return nil unless mhead['message-id'] =~ Re0[:'message-id']
77
+
78
+ dscontents = [Sisimai::Bite.DELIVERYSTATUS]
79
+ hasdivided = mbody.split("\n")
80
+ rfc822list = [] # (Array) Each line in message/rfc822 part string
81
+ blanklines = 0 # (Integer) The number of blank lines
82
+ readcursor = 0 # (Integer) Points the current cursor position
83
+ recipients = 0 # (Integer) The number of 'Final-Recipient' header
84
+ v = nil
85
+
86
+ readcursor |= Indicators[:deliverystatus]
87
+ hasdivided.each do |e|
88
+ if (readcursor & Indicators[:'message-rfc822']).zero?
89
+ # Beginning of the original message part
90
+ if e =~ Re1[:rfc822]
91
+ readcursor |= Indicators[:'message-rfc822']
92
+ next
93
+ end
94
+ end
95
+
96
+ if readcursor & Indicators[:'message-rfc822'] > 0
97
+ # After "Original mail as follows:" line
98
+ #
99
+ # From owner-2ndml@example.com Mon Nov 20 18:10:11 2017
100
+ # Return-Path: <owner-2ndml@example.com>
101
+ # ...
102
+ #
103
+ if e.empty?
104
+ blanklines += 1
105
+ break if blanklines > 1
106
+ next
107
+ end
108
+ e = e.sub(/\A[ ]{3}/, '')
109
+ rfc822list << e
110
+ else
111
+ # Before "message/rfc822"
112
+ next if (readcursor & Indicators[:deliverystatus]).zero?
113
+ next if e.empty?
114
+
115
+ # Duplicated Message-ID in <2ndml@example.com>.
116
+ # Original mail as follows:
117
+ v = dscontents[-1]
118
+
119
+ if cv = e.match(/[<]([^ ]+?[@][^ ]+?)[>][.]\z/)
120
+ # Duplicated Message-ID in <2ndml@example.com>.
121
+ if v['recipient']
122
+ # There are multiple recipient addresses in the message body.
123
+ dscontents << Sisimai::Bite.DELIVERYSTATUS
124
+ v = dscontents[-1]
125
+ end
126
+ v['recipient'] = cv[1]
127
+ v['diagnosis'] = e
128
+ recipients += 1
129
+ else
130
+ # If you know the general guide of this list, please send mail with
131
+ # the mail body
132
+ v['diagnosis'] ||= ''
133
+ v['diagnosis'] += e
134
+ end
135
+ end
136
+ end
137
+ return nil if recipients.zero?
138
+ require 'sisimai/string'
139
+
140
+ dscontents.map do |e|
141
+ e['diagnosis'] = Sisimai::String.sweep(e['diagnosis'])
142
+ e['agent'] = self.smtpagent
143
+ e.each_key { |a| e[a] ||= '' }
144
+
145
+ ErrorTable.each_key do |f|
146
+ # Try to match with error messages defined in ErrorTable
147
+ next unless e['diagnosis'] =~ ErrorTable[f]
148
+ e['reason'] = f.to_s
149
+ break
150
+ end
151
+
152
+ unless e['reason']
153
+ # Error messages in the message body did not matched
154
+ ErrorTitle.each_key do |f|
155
+ # Try to match with the Subject string
156
+ next unless mhead['subject'] =~ ErrorTitle[f]
157
+ e['reason'] = f.to_s
158
+ break
159
+ end
160
+ end
161
+ end
162
+
163
+ rfc822part = Sisimai::RFC5322.weedout(rfc822list)
164
+ return { 'ds' => dscontents, 'rfc822' => rfc822part }
165
+ end
166
+
167
+ end
168
+ end
169
+ end
170
+