sisimai 5.6.0-java → 5.7.1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake-test.yml +0 -4
  3. data/ChangeLog.md +47 -0
  4. data/README-JA.md +19 -16
  5. data/README.md +23 -21
  6. data/lib/sisimai/address.rb +8 -31
  7. data/lib/sisimai/arf.rb +5 -6
  8. data/lib/sisimai/eb.rb +116 -0
  9. data/lib/sisimai/fact.rb +33 -51
  10. data/lib/sisimai/lda.rb +20 -18
  11. data/lib/sisimai/lhost/activehunter.rb +0 -2
  12. data/lib/sisimai/lhost/amazonses.rb +17 -18
  13. data/lib/sisimai/lhost/apachejames.rb +0 -1
  14. data/lib/sisimai/lhost/biglobe.rb +0 -16
  15. data/lib/sisimai/lhost/courier.rb +9 -7
  16. data/lib/sisimai/lhost/deutschetelekom.rb +120 -0
  17. data/lib/sisimai/lhost/domino.rb +2 -4
  18. data/lib/sisimai/lhost/dragonfly.rb +0 -27
  19. data/lib/sisimai/lhost/einsundeins.rb +4 -12
  20. data/lib/sisimai/lhost/exchange2003.rb +12 -11
  21. data/lib/sisimai/lhost/exchange2007.rb +17 -17
  22. data/lib/sisimai/lhost/exim.rb +34 -81
  23. data/lib/sisimai/lhost/ezweb.rb +15 -51
  24. data/lib/sisimai/lhost/fml.rb +8 -32
  25. data/lib/sisimai/lhost/gmail.rb +10 -32
  26. data/lib/sisimai/lhost/gmx.rb +7 -24
  27. data/lib/sisimai/lhost/googlegroups.rb +6 -5
  28. data/lib/sisimai/lhost/googleworkspace.rb +2 -5
  29. data/lib/sisimai/lhost/imailserver.rb +4 -9
  30. data/lib/sisimai/lhost/kddi.rb +8 -21
  31. data/lib/sisimai/lhost/mailfoundry.rb +0 -2
  32. data/lib/sisimai/lhost/mailmarshal.rb +1 -3
  33. data/lib/sisimai/lhost/messagingserver.rb +4 -15
  34. data/lib/sisimai/lhost/mfilter.rb +0 -1
  35. data/lib/sisimai/lhost/mimecast.rb +0 -1
  36. data/lib/sisimai/lhost/notes.rb +3 -3
  37. data/lib/sisimai/lhost/opensmtpd.rb +0 -40
  38. data/lib/sisimai/lhost/postfix.rb +14 -14
  39. data/lib/sisimai/lhost/qmail.rb +23 -89
  40. data/lib/sisimai/lhost/sendmail.rb +8 -7
  41. data/lib/sisimai/lhost/trendmicro.rb +5 -4
  42. data/lib/sisimai/lhost/v5sendmail.rb +2 -2
  43. data/lib/sisimai/lhost/verizon.rb +4 -4
  44. data/lib/sisimai/lhost/x1.rb +1 -2
  45. data/lib/sisimai/lhost/x2.rb +0 -2
  46. data/lib/sisimai/lhost/x3.rb +4 -9
  47. data/lib/sisimai/lhost/x6.rb +0 -1
  48. data/lib/sisimai/lhost/zoho.rb +0 -12
  49. data/lib/sisimai/lhost.rb +38 -19
  50. data/lib/sisimai/message.rb +1 -1
  51. data/lib/sisimai/order.rb +4 -1
  52. data/lib/sisimai/reason/authfailure.rb +8 -7
  53. data/lib/sisimai/reason/badreputation.rb +5 -4
  54. data/lib/sisimai/reason/blocked.rb +6 -5
  55. data/lib/sisimai/reason/contenterror.rb +8 -5
  56. data/lib/sisimai/reason/delivered.rb +3 -2
  57. data/lib/sisimai/reason/emailtoolarge.rb +7 -6
  58. data/lib/sisimai/reason/expired.rb +16 -4
  59. data/lib/sisimai/reason/failedstarttls.rb +5 -3
  60. data/lib/sisimai/reason/feedback.rb +2 -1
  61. data/lib/sisimai/reason/filtered.rb +9 -8
  62. data/lib/sisimai/reason/hasmoved.rb +5 -4
  63. data/lib/sisimai/reason/hostunknown.rb +14 -4
  64. data/lib/sisimai/reason/mailboxfull.rb +10 -8
  65. data/lib/sisimai/reason/mailererror.rb +3 -2
  66. data/lib/sisimai/reason/networkerror.rb +16 -3
  67. data/lib/sisimai/reason/norelaying.rb +8 -6
  68. data/lib/sisimai/reason/notaccept.rb +15 -7
  69. data/lib/sisimai/reason/notcompliantrfc.rb +5 -3
  70. data/lib/sisimai/reason/onhold.rb +8 -7
  71. data/lib/sisimai/reason/policyviolation.rb +11 -5
  72. data/lib/sisimai/reason/ratelimited.rb +5 -4
  73. data/lib/sisimai/reason/rejected.rb +24 -14
  74. data/lib/sisimai/reason/requireptr.rb +5 -4
  75. data/lib/sisimai/reason/securityerror.rb +5 -3
  76. data/lib/sisimai/reason/spamdetected.rb +6 -5
  77. data/lib/sisimai/reason/suppressed.rb +4 -3
  78. data/lib/sisimai/reason/suspend.rb +8 -3
  79. data/lib/sisimai/reason/syntaxerror.rb +5 -11
  80. data/lib/sisimai/reason/systemerror.rb +21 -2
  81. data/lib/sisimai/reason/systemfull.rb +4 -3
  82. data/lib/sisimai/reason/undefined.rb +2 -1
  83. data/lib/sisimai/reason/userunknown.rb +15 -9
  84. data/lib/sisimai/reason/vacation.rb +2 -1
  85. data/lib/sisimai/reason/virusdetected.rb +6 -5
  86. data/lib/sisimai/reason.rb +47 -42
  87. data/lib/sisimai/rfc1123.rb +1 -1
  88. data/lib/sisimai/rfc1894.rb +15 -8
  89. data/lib/sisimai/rfc2045.rb +8 -5
  90. data/lib/sisimai/rfc3464/thirdparty.rb +11 -10
  91. data/lib/sisimai/rfc3464.rb +10 -14
  92. data/lib/sisimai/rfc3834.rb +6 -5
  93. data/lib/sisimai/rfc791.rb +3 -38
  94. data/lib/sisimai/rhost/aol.rb +3 -2
  95. data/lib/sisimai/rhost/apple.rb +12 -11
  96. data/lib/sisimai/rhost/cloudflare.rb +3 -2
  97. data/lib/sisimai/rhost/cox.rb +38 -37
  98. data/lib/sisimai/rhost/facebook.rb +17 -16
  99. data/lib/sisimai/rhost/franceptt.rb +39 -38
  100. data/lib/sisimai/rhost/godaddy.rb +35 -34
  101. data/lib/sisimai/rhost/google.rb +22 -21
  102. data/lib/sisimai/rhost/gsuite.rb +8 -7
  103. data/lib/sisimai/rhost/iua.rb +11 -10
  104. data/lib/sisimai/rhost/kddi.rb +3 -2
  105. data/lib/sisimai/rhost/messagelabs.rb +13 -12
  106. data/lib/sisimai/rhost/microsoft.rb +37 -32
  107. data/lib/sisimai/rhost/mimecast.rb +18 -17
  108. data/lib/sisimai/rhost/nttdocomo.rb +10 -9
  109. data/lib/sisimai/rhost/outlook.rb +3 -2
  110. data/lib/sisimai/rhost/spectrum.rb +19 -18
  111. data/lib/sisimai/rhost/tencent.rb +10 -9
  112. data/lib/sisimai/rhost/yahooinc.rb +11 -10
  113. data/lib/sisimai/rhost/zoho.rb +8 -7
  114. data/lib/sisimai/rhost.rb +1 -1
  115. data/lib/sisimai/smtp/command.rb +13 -8
  116. data/lib/sisimai/smtp/failure.rb +9 -8
  117. data/lib/sisimai/smtp/reply.rb +23 -22
  118. data/lib/sisimai/smtp/status.rb +164 -159
  119. data/lib/sisimai/smtp/transcript.rb +3 -2
  120. data/lib/sisimai/string.rb +0 -12
  121. data/lib/sisimai/version.rb +1 -1
  122. data/lib/sisimai.rb +2 -1
  123. data/set-of-emails/maildir/bsd/lhost-deutschetelekom-01.eml +66 -0
  124. data/set-of-emails/maildir/bsd/lhost-deutschetelekom-02.eml +68 -0
  125. data/set-of-emails/maildir/bsd/lhost-deutschetelekom-03.eml +50 -0
  126. data/set-of-emails/maildir/bsd/lhost-postfix-81.eml +130 -0
  127. data/set-of-emails/should-not-crash/go-423-deeply-nested-mime-parts.eml +20050 -0
  128. data/set-of-emails/should-not-crash/p5-664-iomart-mail-filter.eml +258 -0
  129. data/set-of-emails/to-be-debugged-because/sisimai-cannot-parse-yet/.gitkeep +0 -0
  130. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f44c6b808f8cc77c1b201c98e3c62326c8d5bbd32010ed17a1665abefc02413
4
- data.tar.gz: d3071f7eb259a1fe59a4d1b4a0cead24888ef3d5a3fe130e469dbc48e82d2117
3
+ metadata.gz: 267d3c5c73f0b2b4363d47d99c5401fb25bdeadb82a7d5ad5db5395cbae36f2e
4
+ data.tar.gz: a436d29643e0656c7596e7612c459ea57f74acc3559b3321c8900478ed80a3a3
5
5
  SHA512:
6
- metadata.gz: 5f71bc52c7f17d6a2a506e97e52fbf30bf42b95bd85deb4349e5ffe6eec16b1336e0b14a31afa7cab2714f2842bcda1656be1589f7eab7b5dc7d430314b75f1a
7
- data.tar.gz: 1fead139305581fcee22a5ea4bb906612fb5fcd5c214d07df34772d88f425b9dca474f48c5fb45c410110967b08249a506c615c711cf7b115b0c16a9d1e33488
6
+ metadata.gz: 58bdb70256c494218eb4c6d6fdb217ee96a65623d49a3eccba1c18772203e538f559b8f8e25fcb8b5e774ab18fe0adb6e5d0c13a5715d56ca66a8f02ee7f3960
7
+ data.tar.gz: 60e4179de572d4fc79ea66802fc5d25424e7a956ab27b7b93538999196c3e357fb8709805e38ea70a7fb9726f1a091c27f501d51bb14b3d8b9e5ff0ff63401f9
@@ -15,8 +15,6 @@ jobs:
15
15
  steps:
16
16
  - name: Checkout the repository(CRuby)
17
17
  uses: actions/checkout@v4
18
- with:
19
- ref: ${{ github.event.pull_request.head.ref }}
20
18
  - name: Setup CRuby
21
19
  uses: ruby/setup-ruby@v1
22
20
  with:
@@ -41,8 +39,6 @@ jobs:
41
39
  steps:
42
40
  - name: Checkout the repository(JRuby)
43
41
  uses: actions/checkout@v4
44
- with:
45
- ref: ${{ github.event.pull_request.head.ref }}
46
42
  - name: Setup JRuby
47
43
  uses: ruby/setup-ruby@v1
48
44
  with:
data/ChangeLog.md CHANGED
@@ -4,6 +4,53 @@ RELEASE NOTES for Ruby version of Sisimai
4
4
  - download: "https://rubygems.org/gems/sisimai"
5
5
  - document: "https://libsisimai.org/"
6
6
 
7
+ v5.7.1
8
+ ---------------------------------------------------------------------------------------------------
9
+ - release: "Fri, 17 Jul 2026 13:22:22 +0900 (JST)"
10
+ - version: "5.7.1"
11
+ - changes:
12
+ - **Bug fixes**
13
+ - Fix duplicated SMTP command `HELO` in `Sisimai::SMTP::Command`.
14
+ - **Mitigation for potential DoS vectors**
15
+ - #441 Limit the nesting depth of MIME parts in Sisimai::RFC2045 class.
16
+ - **Code improvements**
17
+ - New class `Sisimai::Eb` for keeping constants.
18
+ - #443 `Sisimai::Eb::Re****` Bounce reason names.
19
+ - #447 `Sisimai::Eb::Ce****` SMTP commands.
20
+ - #448 `Sisimai::Eb::Ae****` Action field values.
21
+
22
+ v5.7.0
23
+ ---------------------------------------------------------------------------------------------------
24
+ - release: "Mon, 22 Jun 2026 16:22:22 +0900 (JST)"
25
+ - version: "5.7.0"
26
+ - changes:
27
+ - **Bug fixes**
28
+ - #414 Bug fix: The value of command should be `RCPT` when `RCPT first` in the error message.
29
+ - #433 Check whether `lowerchunk` is nil or not to avoid `NoMethodError`, `SystemStackError`
30
+ in `haircut` method of `Sisimai::RFC2045`. #434 #436 Thanks to @SAY-5.
31
+ - **MTA modules and error message patterns**
32
+ - #410 #412 Improvement in error message patterns.
33
+ - Update error message patterns in `AuthFailure`, `ContentError`, `NoRelaying`, `Rejected`,
34
+ `UserUnknown`, `SystemError`, `Suspend`, and `Sisimai::Rhost::Microsoft`.
35
+ - Remove error message patterns already defined in `Sisimai::Reason` from some MTA moudles of
36
+ `Sisimai::Lhost`.
37
+ - Move error message patterns from some MTA modules of `Sisimai::Lhost` to `Sisimai::Reason`.
38
+ - #413 List all the Zoho domains.
39
+ - Update the order of `ClassOrder` in `Sisimai::Reason`.
40
+ - #421 Code improvement for detecting bounce messages returned from Google Groups.
41
+ - #437 Implement `Sisimai::Lhost::DeutscheTelekom` to decode bounce messages generated by Smail
42
+ 3 or Deutsche Telekom.
43
+ - **Code improvements and Environment**
44
+ - **#430 Sisimai does not support Ruby 4.0.0 until the end of 2027.**
45
+ - #417 Use a switch statement instead of if-else for better readability.
46
+ - #423 Fix and update comments in `Sisimai::SMTP::Status`.
47
+ - #428 Remove useless code blocks.
48
+ - **EXPERIMENTAL Features**
49
+ - #424 #425 Change the data type of `Toxic` field implemented at v5.5.0 from Boolean to Integer
50
+ with `-1` as the default value to allow score-based evaluation of recipient address toxicity.
51
+ - #426 #427 Implement `Bogus` field as an Integer with `-1` as the default value to record the
52
+ unreliability score of a bounce message.
53
+
7
54
  v5.6.0
8
55
  ---------------------------------------------------------------------------------------------------
9
56
  - release: "Mon, 2 Feb 2026 18:30:22 +0900 (JST)"
data/README-JA.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ![](https://libsisimai.org/static/images/logo/sisimai-x01.png)
2
- [![License](https://img.shields.io/badge/license-BSD%202--Clause-orange.svg)](https://github.com/sisimai/rb-sisimai/blob/master/LICENSE)
2
+ [![License](https://img.shields.io/badge/license-BSD%202--Clause-orange.svg)](https://github.com/sisimai/rb-sisimai/blob/5-stable/LICENSE)
3
3
  [![Ruby](https://img.shields.io/badge/ruby-v2.5.0--v3.4.0-red.svg)](https://www.ruby-lang.org/)
4
4
  [![Gem Version](https://badge.fury.io/rb/sisimai.svg)](https://badge.fury.io/rb/sisimai)
5
5
  [![codecov](https://codecov.io/github/sisimai/rb-sisimai/graph/badge.svg?token=YGkyluNWiZ)](https://codecov.io/github/sisimai/rb-sisimai)
@@ -65,14 +65,15 @@ Sisimai(シシマイ)は複雑で多種多様なバウンスメールを解析
65
65
  The key features of Sisimai
66
66
  ---------------------------------------------------------------------------------------------------
67
67
  * __バウンスメールを構造化したデータに変換__
68
- * 以下27項目の情報を含むデータ構造[^2]
68
+ * 以下28項目の情報を含むデータ構造[^2]
69
69
  * __基本的情報__: `timestamp`, `origin`
70
70
  * __発信者情報__: `addresser`, `senderdomain`,
71
71
  * __受信者情報__: `recipient`, `destination`, `alias`
72
72
  * __配信の情報__: `action`, `replycode`, `deliverystatus`, `command`
73
73
  * __エラー情報__: `reason`, `diagnosticcode`, `diagnostictype`, `feedbacktype`, `hardbounce`
74
74
  * __メール情報__: `subject`, `messageid`, `listid`,
75
- * __その他情報__: `decodedby`, `timezoneoffset`, `lhost`, `rhost`, `token`, `catch`
75
+ * __評価用項目__: `toxic`, `bogus`, `catch`
76
+ * __その他情報__: `decodedby`, `timezoneoffset`, `lhost`, `rhost`, `token`
76
77
  * __出力可能な形式__
77
78
  * Ruby (Hash, Array)
78
79
  * JSON
@@ -83,9 +84,9 @@ The key features of Sisimai
83
84
  * `gem install`
84
85
  * `git clone && make`
85
86
  * __高い解析精度__
86
- * [60種類のMTAs/MDAs/ESPs](https://libsisimai.org/en/engine/)に対応
87
+ * [61種類のMTAs/MDAs/ESPs](https://libsisimai.org/en/engine/)に対応
87
88
  * Feedback Loop(ARF)にも対応
88
- * [36種類のバウンス理由](https://libsisimai.org/en/reason/)を検出
89
+ * [34種類のバウンス理由](https://libsisimai.org/en/reason/)を検出
89
90
 
90
91
  [^2]: コールバック機能を使用すると`catch`アクセサの下に独自のデータを追加できます
91
92
 
@@ -115,10 +116,10 @@ Install
115
116
  ### From RubyGems.org
116
117
  ```shell
117
118
  $ sudo gem install sisimai
118
- Fetching: sisimai-5.6.0.gem (100%)
119
- Successfully installed sisimai-5.6.0
120
- Parsing documentation for sisimai-5.6.0
121
- Installing ri documentation for sisimai-5.6.0
119
+ Fetching: sisimai-5.7.1.gem (100%)
120
+ Successfully installed sisimai-5.7.1
121
+ Parsing documentation for sisimai-5.7.1
122
+ Installing ri documentation for sisimai-5.7.1
122
123
  Done installing documentation for sisimai after 6 seconds
123
124
  1 gem installed
124
125
  ```
@@ -146,13 +147,13 @@ if [ -d "/usr/local/jr" ]; then \
146
147
  ...
147
148
  3 gems installed
148
149
  /opt/local/bin/rake install
149
- sisimai 5.6.0 built to pkg/sisimai-5.6.0.gem.
150
- sisimai (5.6.0) installed.
150
+ sisimai 5.7.1 built to pkg/sisimai-5.7.1.gem.
151
+ sisimai (5.7.1) installed.
151
152
  if [ -d "/usr/local/jr" ]; then \
152
153
  PATH="/usr/local/jr/bin:$PATH" /usr/local/jr/bin/rake install; \
153
154
  fi
154
- sisimai 5.6.0 built to pkg/sisimai-5.6.0-java.gem.
155
- sisimai (5.6.0) installed.
155
+ sisimai 5.7.1 built to pkg/sisimai-5.7.1-java.gem.
156
+ sisimai (5.7.1) installed.
156
157
  ```
157
158
 
158
159
  Usage
@@ -333,7 +334,8 @@ Output example
333
334
  "timezoneoffset": "+0900",
334
335
  "replycode": 550,
335
336
  "token": "84656774898baa90660be3e12fe0526e108d4473",
336
- "toxic": false,
337
+ "bogus": -1,
338
+ "toxic": -1,
337
339
  "diagnostictype": "SMTP",
338
340
  "timestamp": 1650119685,
339
341
  "diagnosticcode": "host gmail-smtp-in.l.google.com[64.233.187.27] said: This mail has been blocked because the sender is unauthenticated. Gmail requires all senders to authenticate with either SPF or DKIM. Authentication results: DKIM = did not pass SPF [relay3.example.com] with ip: [192.0.2.22] = did not pass For instructions on setting up authentication, go to https://support.google.com/mail/answer/81126#authentication c2-202200202020202020222222cat.127 - gsmtp (in reply to end of DATA command)",
@@ -405,6 +407,7 @@ Sisimai 5で3個のESPモジュール名(解析エンジン)が変更になり
405
407
  | Zoho (added at v5.5.0) | なし | `Rhost::Zoho` |
406
408
  | DragonFly Mail Agent (added at v5.1.0) | なし | `Lhost::DragonFly` |
407
409
  | Mimecast (added at v5.5.0) | なし | `Lhost::Mimecast` |
410
+ | DeutscheTelekom (added at v5.7.0) | なし | `Lhost::DeutscheTelekom` |
408
411
 
409
412
  Bounce Reasons
410
413
  ---------------------------------------------------------------------------------------------------
@@ -436,7 +439,7 @@ Bug report
436
439
  Emails could not be decoded
437
440
  ---------------------------------------------------------------------------------------------------
438
441
  Sisimaiで解析できないバウンスメールは
439
- [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)リポジトリに追加してPull-Requestを送ってください。
442
+ [set-of-emails/to-be-debugged-because/sisimai-cannot-parse-yet](https://github.com/sisimai/rb-sisimai/tree/5-stable/set-of-emails/to-be-debugged-because/sisimai-cannot-parse-yet)ディレクトリに追加してPull-Requestを送ってください。
440
443
 
441
444
  Other Information
442
445
  ===================================================================================================
@@ -453,7 +456,7 @@ Related sites
453
456
 
454
457
  See also
455
458
  ---------------------------------------------------------------------------------------------------
456
- * [README.md - README.md in English(🇬🇧)](https://github.com/sisimai/rb-sisimai/blob/master/README.md)
459
+ * [README.md - README.md in English(🇬🇧)](https://github.com/sisimai/rb-sisimai/blob/5-stable/README.md)
457
460
  * [RFC3463 - Enhanced Mail System Status Codes](https://tools.ietf.org/html/rfc3463)
458
461
  * [RFC3464 - An Extensible Message Format for Delivery Status Notifications](https://tools.ietf.org/html/rfc3464)
459
462
  * [RFC3834 - Recommendations for Automatic Responses to Electronic Mail](https://tools.ietf.org/html/rfc3834)
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ![](https://libsisimai.org/static/images/logo/sisimai-x01.png)
2
- [![License](https://img.shields.io/badge/license-BSD%202--Clause-orange.svg)](https://github.com/sisimai/rb-sisimai/blob/master/LICENSE)
2
+ [![License](https://img.shields.io/badge/license-BSD%202--Clause-orange.svg)](https://github.com/sisimai/rb-sisimai/blob/5-stable/LICENSE)
3
3
  [![Ruby](https://img.shields.io/badge/ruby-v2.5.0--v3.4.0-red.svg)](https://www.ruby-lang.org/)
4
4
  [![Gem Version](https://badge.fury.io/rb/sisimai.svg)](https://badge.fury.io/rb/sisimai)
5
5
  [![codecov](https://codecov.io/github/sisimai/rb-sisimai/graph/badge.svg?token=YGkyluNWiZ)](https://codecov.io/github/sisimai/rb-sisimai)
@@ -67,14 +67,15 @@ of Sisimai is ported from [the Perl version of Sisimai](https://github.com/sisim
67
67
  The key features of Sisimai
68
68
  ---------------------------------------------------------------------------------------------------
69
69
  * __Decode email bounces to structured data__
70
- * Sisimai provides detailed insights into bounce emails by extracting 27 key data points.[^2]
70
+ * Sisimai provides detailed insights into bounce emails by extracting 28 key data points.[^2]
71
71
  * __Essential information__: `timestamp`, `origin`
72
72
  * __Sender information__: `addresser`, `senderdomain`,
73
73
  * __Recipient information__: `recipient`, `destination`, `alias`
74
74
  * __Delivery information__: `action`, `replycode`, `deliverystatus`, `command`
75
75
  * __Bounce details__: `reason`, `diagnosticcode`, `diagnostictype`, `feedbacktype`, `feedbackid`, `hardbounce`
76
76
  * __Message details__: `subject`, `messageid`, `listid`,
77
- * __Additional information__: `decodedby`, `timezoneoffset`, `lhost`, `rhost`, `token`, `catch`, `toxic`
77
+ * __Evaluation metrics (User-calculated)__: `toxic`, `bogus`, `catch`
78
+ * __Additional information__: `decodedby`, `timezoneoffset`, `lhost`, `rhost`, `token`
78
79
  * Output formats
79
80
  * Ruby (Hash, Array)
80
81
  * JSON
@@ -85,7 +86,7 @@ The key features of Sisimai
85
86
  * `gem install`
86
87
  * `git clone && make`
87
88
  * __High Precision of Analysis__
88
- * Support [60 MTAs/MDAs/ESPs](https://libsisimai.org/en/engine/)
89
+ * Support [61 MTAs/MDAs/ESPs](https://libsisimai.org/en/engine/)
89
90
  * Support Feedback Loop Message(ARF)
90
91
  * Can detect [34 bounce reasons](https://libsisimai.org/en/reason/)
91
92
 
@@ -114,10 +115,10 @@ Install
114
115
  ### From RubyGems
115
116
  ```shell
116
117
  $ sudo gem install sisimai
117
- Fetching: sisimai-5.6.0.gem (100%)
118
- Successfully installed sisimai-5.6.0
119
- Parsing documentation for sisimai-5.6.0
120
- Installing ri documentation for sisimai-5.6.0
118
+ Fetching: sisimai-5.7.1.gem (100%)
119
+ Successfully installed sisimai-5.7.1
120
+ Parsing documentation for sisimai-5.7.1
121
+ Installing ri documentation for sisimai-5.7.1
121
122
  Done installing documentation for sisimai after 6 seconds
122
123
  1 gem installed
123
124
  ```
@@ -145,13 +146,13 @@ if [ -d "/usr/local/jr" ]; then \
145
146
  ...
146
147
  3 gems installed
147
148
  /opt/local/bin/rake install
148
- sisimai 5.6.0 built to pkg/sisimai-5.6.0.gem.
149
- sisimai (5.6.0) installed.
149
+ sisimai 5.7.1 built to pkg/sisimai-5.7.1.gem.
150
+ sisimai (5.7.1) installed.
150
151
  if [ -d "/usr/local/jr" ]; then \
151
152
  PATH="/usr/local/jr/bin:$PATH" /usr/local/jr/bin/rake install; \
152
153
  fi
153
- sisimai 5.6.0 built to pkg/sisimai-5.6.0-java.gem.
154
- sisimai (5.6.0) installed.
154
+ sisimai 5.7.1 built to pkg/sisimai-5.7.1-java.gem.
155
+ sisimai (5.7.1) installed.
155
156
  ```
156
157
 
157
158
  Usage
@@ -332,7 +333,8 @@ Output example
332
333
  "timezoneoffset": "+0900",
333
334
  "replycode": 550,
334
335
  "token": "84656774898baa90660be3e12fe0526e108d4473",
335
- "toxic": false,
336
+ "bogus": -1,
337
+ "toxic": -1,
336
338
  "diagnostictype": "SMTP",
337
339
  "timestamp": 1650119685,
338
340
  "diagnosticcode": "host gmail-smtp-in.l.google.com[64.233.187.27] said: This mail has been blocked because the sender is unauthenticated. Gmail requires all senders to authenticate with either SPF or DKIM. Authentication results: DKIM = did not pass SPF [relay3.example.com] with ip: [192.0.2.22] = did not pass For instructions on setting up authentication, go to https://support.google.com/mail/answer/81126#authentication c2-202200202020202020222222cat.127 - gsmtp (in reply to end of DATA command)",
@@ -356,12 +358,12 @@ Beginning with v5.5.0, Sisimai requires **Ruby 2.5.0 or later.**
356
358
  | System requirements (CRuby) | 2.1 - 3.3.0 | **2.5** or later |
357
359
  | System requirements (JRuby) | 9.0.4.0 - 9.1.17.0 | **9.2** or later |
358
360
  | Callback feature for the original email file | N/A | Available[^3] |
359
- | The number of MTA/ESP modules | 68 | 60 |
361
+ | The number of MTA/ESP modules | 68 | 61 |
360
362
  | The number of detectable bounce reasons | 29 | 34 |
361
363
  | Dependencies (Except Ruby Standard Gems) | 1 gem | 1 gem |
362
- | Source lines of code | 10,300 lines | 9,700 lines |
364
+ | Source lines of code | 10,300 lines | 9,500 lines |
363
365
  | Test frameworks | rspec | minitest |
364
- | The number of tests in spec/ or test/ directory | 311,000 tests | 240,000 tests |
366
+ | The number of tests in spec/ or test/ directory | 311,000 tests | 255,000 tests |
365
367
  | The number of bounce emails decoded/sec (CRuby)[^4] | 620 emails | 620 emails |
366
368
  | License | 2 Clause BSD | 2 Caluse BSD |
367
369
  | Commercial support | Available | Available |
@@ -406,6 +408,7 @@ available at [LIBSISIMAI.ORG/EN/ENGINE](https://libsisimai.org/en/engine/)
406
408
  | Zoho (added at v5.5.0) | None | `Rhost::Zoho` |
407
409
  | DragonFly Mail Agent (added at v5.1.0) | None | `Lhost::DragonFly` |
408
410
  | Mimecast (added at v5.5.0) | None | `Lhost::Mimecast` |
411
+ | DeutscheTelekom (added at v5.7.0) | None | `Lhost::DeutscheTelekom` |
409
412
 
410
413
  Bounce Reasons
411
414
  ---------------------------------------------------------------------------------------------------
@@ -436,10 +439,9 @@ Please use the [issue tracker](https://github.com/sisimai/rb-sisimai/issues) to
436
439
 
437
440
  Emails could not be decoded
438
441
  ---------------------------------------------------------------------------------------------------
439
- Bounce mails which could not be decoded by Sisimai are saved in the repository
440
- [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).
441
- If you have found any bounce email cannot be decoded using Sisimai, please add the email into the
442
- directory and send Pull-Request to this repository.
442
+ Bounce mails which could not be decoded by Sisimai are saved in
443
+ [set-of-emails/to-be-debugged-because/sisimai-cannot-parse-yet](https://github.com/sisimai/rb-sisimai/tree/5-stable/set-of-emails/to-be-debugged-because/sisimai-cannot-parse-yet) directory. If you have found any bounce email cannot be decoded
444
+ using Sisimai, please add the email into the directory and send Pull-Request to this repository.
443
445
 
444
446
  Other Information
445
447
  ===================================================================================================
@@ -456,7 +458,7 @@ Related Sites
456
458
 
457
459
  See also
458
460
  ---------------------------------------------------------------------------------------------------
459
- * [README-JA.md - README.md in Japanese(🇯🇵)](https://github.com/sisimai/rb-sisimai/blob/master/README-JA.md)
461
+ * [README-JA.md - README.md in Japanese(🇯🇵)](https://github.com/sisimai/rb-sisimai/blob/5-stable/README-JA.md)
460
462
  * [RFC3463 - Enhanced Mail System Status Codes](https://tools.ietf.org/html/rfc3463)
461
463
  * [RFC3464 - An Extensible Message Format for Delivery Status Notifications](https://tools.ietf.org/html/rfc3464)
462
464
  * [RFC3834 - Recommendations for Automatic Responses to Electronic Mail](https://tools.ietf.org/html/rfc3834)
@@ -147,8 +147,8 @@ module Sisimai
147
147
  # Check each characters
148
148
  if Delimiters[e]
149
149
  # The character is a delimiter character
150
- if e == ','
151
- # Separator of email addresses or not
150
+ case e
151
+ when "," # Separator of email addresses or not
152
152
  if v[:address].start_with?('<') && v[:address].end_with?('>') && v[:address].include?('@')
153
153
  # An email address has already been picked
154
154
  if readcursor & Indicators[:'comment-block'] > 0
@@ -168,11 +168,7 @@ module Sisimai
168
168
  # "Neko, Nyaan" <neko@nyaan.example.org> OR <"neko,nyaan"@example.org>
169
169
  p.empty? ? (v[:name] += e) : (v[p] += e)
170
170
  end
171
- next
172
- end # End of if(',')
173
-
174
- if e == '<'
175
- # <: The beginning of an email address or not
171
+ when "<" # <: The beginning of an email address or not
176
172
  if v[:address].size > 0
177
173
  p.empty? ? (v[:name] += e) : (v[p] += e)
178
174
  else
@@ -181,12 +177,7 @@ module Sisimai
181
177
  v[:address] += e
182
178
  p = :address
183
179
  end
184
- next
185
- end
186
- # End of if('<')
187
-
188
- if e == '>'
189
- # >: The end of an email address or not
180
+ when ">" # >: The end of an email address or not
190
181
  if readcursor & Indicators[:'email-address'] > 0
191
182
  # <neko@example.org>
192
183
  readcursor &= ~Indicators[:'email-address']
@@ -196,11 +187,7 @@ module Sisimai
196
187
  # a comment block or a display name
197
188
  p.empty? ? (v[:name] == e) : (v[:comment] -= e)
198
189
  end
199
- next
200
- end # End of if('>')
201
-
202
- if e == '('
203
- # The beginning of a comment block or not
190
+ when "(" # The beginning of a comment block or not
204
191
  if readcursor & Indicators[:'email-address'] > 0
205
192
  # <"neko(nyaan)"@example.org> or <neko(nyaan)@example.org>
206
193
  if v[:address].include?('"')
@@ -228,11 +215,7 @@ module Sisimai
228
215
  v[:comment] += e
229
216
  p = :comment
230
217
  end
231
- next
232
- end # End of if('(')
233
-
234
- if e == ')'
235
- # The end of a comment block or not
218
+ when ")" # The end of a comment block or not
236
219
  if readcursor & Indicators[:'email-address'] > 0
237
220
  # <"neko(nyaan)"@example.org> OR <neko(nyaan)@example.org>
238
221
  if v[:address].include?('"')
@@ -255,11 +238,7 @@ module Sisimai
255
238
  v[:name] += e
256
239
  p = ''
257
240
  end
258
- next
259
- end # End of if(')')
260
-
261
- if e == '"'
262
- # The beginning or the end of a quoted-string
241
+ when '"' # The beginning or the end of a quoted-string
263
242
  if p.size > 0
264
243
  # email-address or comment-block
265
244
  v[p] += e
@@ -271,12 +250,10 @@ module Sisimai
271
250
  readcursor &= ~Indicators[:'quoted-string']
272
251
  p = ''
273
252
  end
274
- next
275
- end # End of if('"')
253
+ end # End of case-when
276
254
  else
277
255
  # The character is not a delimiter
278
256
  p.empty? ? (v[:name] += e) : (v[p] += e)
279
- next
280
257
  end
281
258
  end
282
259
 
data/lib/sisimai/arf.rb CHANGED
@@ -2,6 +2,7 @@ module Sisimai
2
2
  # Sisimai::ARF is a decoder for the email returned as a FeedBack Loop report message.
3
3
  module ARF
4
4
  class << self
5
+ require 'sisimai/eb'
5
6
  require 'sisimai/lhost'
6
7
  require 'sisimai/rfc5322'
7
8
 
@@ -193,7 +194,7 @@ module Sisimai
193
194
  # X-Apple-Unsubscribe: true
194
195
  last if mhead["x-apple-unsubscribe"] != "true" || mhead["from"].include?('@') == false
195
196
  dscontents[0]["recipient"] = mhead["from"]
196
- dscontents[0]["diagnosis"] = Sisimai::String.sweep(emailparts[0])
197
+ dscontents[0]["diagnosis"] = emailparts[0]
197
198
  dscontents[0]["feedbacktype"] = "opt-out"
198
199
 
199
200
  # Addpend To: field as a pseudo header
@@ -214,15 +215,13 @@ module Sisimai
214
215
  end
215
216
  return nil if recipients == 0
216
217
 
217
- anotherone = ": #{Sisimai::String.sweep(anotherone)}" if anotherone != ""
218
- anotherone = anotherone.chop if anotherone[-1, 1] == ","
219
-
218
+ anotherone = ": #{anotherone.chop}" if anotherone != ""
220
219
  j = -1
221
220
  dscontents.each do |e|
222
221
  # Tidy up the error message in e.Diagnosis, Try to detect the bounce reason.
223
222
  j += 1
224
- e["diagnosis"] = Sisimai::String.sweep(e["diagnosis"] + anotherone)
225
- e["reason"] = "feedback"
223
+ e["diagnosis"] = e["diagnosis"] + anotherone
224
+ e["reason"] = Sisimai::Eb::ReFEED
226
225
  e["rhost"] = remotehost
227
226
  e["lhost"] = reportedby
228
227
  e["date"] = timestamp0
data/lib/sisimai/eb.rb ADDED
@@ -0,0 +1,116 @@
1
+ module Sisimai
2
+ # Sisimai::Eb - Package "eb" provides constants for the email bounce.
3
+ module Eb
4
+ # _ ______
5
+ # ___| |__ / / _ \ ___ __ _ ___ ___ _ __
6
+ # / _ \ '_ \ / /| |_) / _ \/ _` / __|/ _ \| '_ \
7
+ # | __/ |_) / / | _ < __/ (_| \__ \ (_) | | | |
8
+ # \___|_.__/_/ |_| \_\___|\__,_|___/\___/|_| |_|
9
+ # bounce reason names
10
+ ReAUTH = "AuthFailure"
11
+ ReFAMA = "BadReputation"
12
+ ReBLOC = "Blocked"
13
+ ReBODY = "ContentError"
14
+ ReSENT = "Delivered"
15
+ ReSIZE = "EmailTooLarge"
16
+ ReTIME = "Expired"
17
+ ReTTLS = "FailedSTARTTLS"
18
+ ReFEED = "Feedback"
19
+ ReFILT = "Filtered"
20
+ ReMOVE = "HasMoved"
21
+ ReHOST = "HostUnknown"
22
+ ReFULL = "MailboxFull"
23
+ ReUNIX = "MailerError"
24
+ ReINET = "NetworkError"
25
+ RePASS = "NoRelaying"
26
+ Re00MX = "NotAccept"
27
+ ReNRFC = "NotCompliantRFC"
28
+ Re___1 = "OnHold"
29
+ ReWONT = "PolicyViolation"
30
+ ReFROM = "Rejected"
31
+ ReQPTR = "RequirePTR"
32
+ ReRATE = "RateLimited"
33
+ ReSAFE = "SecurityError"
34
+ ReSPAM = "SpamDetected"
35
+ ReSTOP = "Suppressed"
36
+ ReQUIT = "Suspend"
37
+ ReCOMM = "SyntaxError"
38
+ RePROC = "SystemError"
39
+ ReDISK = "SystemFull"
40
+ Re___0 = "Undefined"
41
+ ReUSER = "UserUnknown"
42
+ ReAWAY = "Vacation"
43
+ ReEXEC = "VirusDetected"
44
+
45
+ # _ ______ _
46
+ # ___| |__ / / ___|___ _ __ ___ _ __ ___ __ _ _ __ __| |
47
+ # / _ \ '_ \ / / | / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` |
48
+ # | __/ |_) / /| |__| (_) | | | | | | | | | | | (_| | | | | (_| |
49
+ # \___|_.__/_/ \____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_|
50
+ CeHELO = "HELO"
51
+ CeEHLO = "EHLO"
52
+ CeMAIL = "MAIL"
53
+ CeRCPT = "RCPT"
54
+ CeDATA = "DATA"
55
+ CeQUIT = "QUIT"
56
+ CeRSET = "RSET"
57
+ CeNOOP = "NOOP"
58
+ CeVRFY = "VRFY"
59
+ CeETRN = "ETRN"
60
+ CeEXPN = "EXPN"
61
+ CeHELP = "HELP"
62
+ CeAUTH = "AUTH"
63
+ CeTTLS = "STARTTLS"
64
+ CeXFWD = "XFORWARD"
65
+ CeCONN = "CONN" # CONN is a pseudo SMTP command used only in Sisimai
66
+
67
+ # _ ___ _ _
68
+ # ___| |__ / / \ ___| |_(_) ___ _ __
69
+ # / _ \ '_ \ / / _ \ / __| __| |/ _ \| '_ \
70
+ # | __/ |_) / / ___ \ (__| |_| | (_) | | | |
71
+ # \___|_.__/_/_/ \_\___|\__|_|\___/|_| |_|
72
+ #
73
+ # https://datatracker.ietf.org/doc/html/rfc3464#page-16
74
+ # 2.3.3 Action field
75
+ # The Action field indicates the action performed by the Reporting-MTA as a result of its attempt
76
+ # to deliver the message to this recipient address. This field MUST be present for each recipient
77
+ # named in the DSN.
78
+ #
79
+ # The syntax for the action-field is:
80
+ # action-field = "Action" ":" action-value
81
+ # action-value = "failed" / "delayed" / "delivered" / "relayed" / "expanded"
82
+ #
83
+ # The action-value may be spelled in any combination of upper and lower case characters.
84
+ #
85
+ # "failed" indicates that the message could not be delivered to the recipient.
86
+ # The Reporting MTA has abandoned any attempts to deliver the message to this
87
+ # recipient. No further notifications should be expected.
88
+ #
89
+ # "delayed" indicates that the Reporting MTA has so far been unable to deliver or relay the
90
+ # message, but it will continue to attempt to do so. Additional notification
91
+ # messages may be issued as the message is further delayed or successfully
92
+ # delivered, or if delivery attempts are later abandoned.
93
+ #
94
+ # "delivered" indicates that the message was successfully delivered to the recipient address
95
+ # specified by the sender, which includes "delivery" to a mailing list exploder.
96
+ # It does not indicate that the message has been read. This is a terminal state
97
+ # and no further DSN for this recipient should be expected.
98
+ #
99
+ # "relayed" indicates that the message has been relayed or gatewayed into an environment
100
+ # that does not accept responsibility for generating DSNs upon successful delivery.
101
+ # This action-value SHOULD NOT be used unless the sender has requested notification
102
+ # of successful delivery for this recipient.
103
+ #
104
+ # "expanded" indicates that the message has been successfully delivered to the recipient
105
+ # address as specified by the sender, and forwarded by the Reporting-MTA beyond
106
+ # that destination to multiple additional recipient addresses. An action-value of
107
+ # "expanded" differs from "delivered" in that "expanded" is not a terminal state.
108
+ # Further "failed" and/or "delayed" notifications may be provided.
109
+ AeFAIL = "failed"
110
+ AeSTAY = "delayed"
111
+ AeSENT = "delivered"
112
+ AePASS = "relayed"
113
+ AeEXPN = "expanded"
114
+ end
115
+ end
116
+