sisimai 5.7.2-java → 5.8.0-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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake-test.yml +2 -2
  3. data/ChangeLog.md +18 -0
  4. data/Developers.mk +4 -0
  5. data/Makefile +1 -0
  6. data/README-JA.md +30 -15
  7. data/README.md +31 -16
  8. data/lib/sisimai/arf.rb +1 -1
  9. data/lib/sisimai/eb.rb +2 -0
  10. data/lib/sisimai/lhost/activehunter.rb +2 -2
  11. data/lib/sisimai/lhost/amazonses.rb +4 -0
  12. data/lib/sisimai/lhost/apachejames.rb +2 -2
  13. data/lib/sisimai/lhost/biglobe.rb +2 -2
  14. data/lib/sisimai/lhost/courier.rb +2 -2
  15. data/lib/sisimai/lhost/deutschetelekom.rb +2 -2
  16. data/lib/sisimai/lhost/domino.rb +3 -4
  17. data/lib/sisimai/lhost/dragonfly.rb +2 -2
  18. data/lib/sisimai/lhost/einsundeins.rb +2 -2
  19. data/lib/sisimai/lhost/exchange2003.rb +2 -2
  20. data/lib/sisimai/lhost/exchange2007.rb +2 -2
  21. data/lib/sisimai/lhost/exim.rb +2 -2
  22. data/lib/sisimai/lhost/ezweb.rb +2 -2
  23. data/lib/sisimai/lhost/fml.rb +2 -2
  24. data/lib/sisimai/lhost/gmail.rb +2 -2
  25. data/lib/sisimai/lhost/gmx.rb +2 -2
  26. data/lib/sisimai/lhost/googlegroups.rb +1 -1
  27. data/lib/sisimai/lhost/googleworkspace.rb +2 -2
  28. data/lib/sisimai/lhost/imailserver.rb +2 -2
  29. data/lib/sisimai/lhost/kddi.rb +2 -2
  30. data/lib/sisimai/lhost/mailfoundry.rb +2 -2
  31. data/lib/sisimai/lhost/mailmarshal.rb +2 -2
  32. data/lib/sisimai/lhost/messagingserver.rb +2 -2
  33. data/lib/sisimai/lhost/mfilter.rb +2 -2
  34. data/lib/sisimai/lhost/mimecast.rb +2 -2
  35. data/lib/sisimai/lhost/notes.rb +2 -2
  36. data/lib/sisimai/lhost/opensmtpd.rb +2 -2
  37. data/lib/sisimai/lhost/postfix.rb +3 -3
  38. data/lib/sisimai/lhost/qmail.rb +2 -2
  39. data/lib/sisimai/lhost/sendmail.rb +4 -4
  40. data/lib/sisimai/lhost/trendmicro.rb +2 -2
  41. data/lib/sisimai/lhost/v5sendmail.rb +2 -4
  42. data/lib/sisimai/lhost/verizon.rb +4 -4
  43. data/lib/sisimai/lhost/x1.rb +2 -2
  44. data/lib/sisimai/lhost/x2.rb +2 -2
  45. data/lib/sisimai/lhost/x3.rb +2 -2
  46. data/lib/sisimai/lhost/x6.rb +2 -2
  47. data/lib/sisimai/lhost/zoho.rb +2 -2
  48. data/lib/sisimai/mail/maildir.rb +4 -2
  49. data/lib/sisimai/mail/stdin.rb +3 -3
  50. data/lib/sisimai/message.rb +4 -2
  51. data/lib/sisimai/reason/authfailure.rb +1 -0
  52. data/lib/sisimai/reason/blocked.rb +1 -0
  53. data/lib/sisimai/reason/ratelimited.rb +3 -2
  54. data/lib/sisimai/reason/requireptr.rb +1 -0
  55. data/lib/sisimai/reason/userunknown.rb +1 -0
  56. data/lib/sisimai/rfc3464.rb +5 -6
  57. data/lib/sisimai/rfc5322.rb +0 -1
  58. data/lib/sisimai/rhost/google.rb +11 -9
  59. data/lib/sisimai/smtp/status.rb +1 -1
  60. data/lib/sisimai/version.rb +1 -1
  61. data/lib/sisimai.rb +28 -4
  62. data/set-of-emails/mailbox/mbox-2 +141 -0
  63. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a713d133864ab6845c95ba347b30385f5c564864c9afa3edeb0b5f37aebcda7e
4
- data.tar.gz: ee3ea2d230b497c8f58c643a387838701118449b6bdb04a23229ff3544e6c782
3
+ metadata.gz: a816f896d667b5911b91755fd60f3507d57d942de3389a88a6ee044e1cfd34be
4
+ data.tar.gz: f47aa956c0b0dcd25f0aac600fb8ec079e7516f4f58b21de00e03913dc725b76
5
5
  SHA512:
6
- metadata.gz: 28936ef912d907d24160bdf111a7f047a85fa7a6aa4f41405d2c3c6aee37bb0ce25a38b5fa21b424bc92af481756a06c608291546db776d96cc4a362f20d9321
7
- data.tar.gz: 53693d2372481b610b312563f1ebec102572fc8b98435c640c05a0a0a5e5a067e763b339e20d8964d3ace364a10eaa8ad2c34be7f4b9cc3fd547b36008df1b0f
6
+ metadata.gz: e062be23ca7cd8625d7f93a7995e95b31818c380eda3019f9a30acbbcbc632562b79c1e7bf066856ffe17ffb9a0a9883c9c2b7f57b13c13131087778bd881f3a
7
+ data.tar.gz: 82c437339fd6d72030e33a6e5cd3ed4ecdd5e6bffb9d12d637fece29a39dbeb8c329098972b158129966220349cca1803be9e8c127d7a17a0034f1799c0ba132
@@ -7,11 +7,11 @@ on:
7
7
  jobs:
8
8
  test-cruby:
9
9
  name: rake test with CRuby ${{ matrix.cruby }}
10
- runs-on: ubuntu-latest
10
+ runs-on: ubuntu-24.04
11
11
  strategy:
12
12
  fail-fast: false
13
13
  matrix:
14
- cruby: ["2.5.9", "3.3.10", "3.4.10"]
14
+ cruby: ["2.5.9", "3.3.13", "3.4.10"]
15
15
  steps:
16
16
  - name: Checkout the repository(CRuby)
17
17
  uses: actions/checkout@v4
data/ChangeLog.md CHANGED
@@ -4,6 +4,24 @@ 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.8.0
8
+ ---------------------------------------------------------------------------------------------------
9
+ - release: "Wed, 11 Nov 2026 20:22:22 +0900 (JST)"
10
+ - version: "5.8.0"
11
+ - **LIMIT THE MAXIMUM EMAIL DATA SIZE FOR MEMORY PROTECTION**
12
+ - The total size of input data (UNIX mbox, memory, or STDIN) is limited to 2GB.
13
+ - Each individual email message (in Maildir/, UNIX mbox, memory, or STDIN) is limited to 64MB.
14
+ - #469 #471
15
+ - **Security Fixes**
16
+ - #458 Add invisible/control character check to Makefile to prevent Trojan Source attacks.
17
+ - #462 Avoid RFC3464 crashes on empty or truncated attached messages. Thanks to @azranel.
18
+ - #463 Check that the return value of `Sisimai::RFC5322.part` is an empty array or not.
19
+ - **Error Message Pattern Updates**
20
+ - #460 Add error message patterns for comcast.net.
21
+ - #468 Update Google SMTP error codes: `454 4.7.0` and `554 5.4.6` as of 15th October 2026.
22
+ - **Other Tiny Improvements**
23
+ - #467 The value of `feedbackId` returned from Amazon SES is set to the `FeedbackID` field.
24
+
7
25
  v5.7.2
8
26
  ---------------------------------------------------------------------------------------------------
9
27
  - release: "Mon, 31 Aug 2026 18:25:22 +0900 (JST)"
data/Developers.mk CHANGED
@@ -37,9 +37,13 @@ DESCR_LENGTH := 50
37
37
  BH_CAN_PARSE := AmazonSES AmazonWorkMail Aol Bigfoot Biglobe Courier EZweb Exim Facebook GSuite \
38
38
  Google KDDI MessageLabs MessagingServer Office365 Postfix SendGrid Sendmail Verizon \
39
39
  X5 Yandex qmail
40
+ INVISIBLES := '[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F]|\xEF\xBB\xBF|\xE2\x80[\xAA-\xAE]|\xE2\x81[\xA6-\xA9]|\xE2\x80[\x8B-\x8F]'
40
41
  # -------------------------------------------------------------------------------------------------
41
42
  .PHONY: clean
42
43
 
44
+ check-invisibles:
45
+ @git --no-pager grep -P -I $(INVISIBLES) '*.pm' && exit 1 || true
46
+
43
47
  private-sample:
44
48
  $(RM) -r ./$(PRIVATEMAILS)
45
49
  $(CP) -vRp ../$(PERL5SISIMAI)/$(PRIVATEMAILS) $(SET_OF_EMAIL)
data/Makefile CHANGED
@@ -62,6 +62,7 @@ user-test:
62
62
 
63
63
  author-test:
64
64
  RUBYOPT="$(RUBYARGUMENT)" rake privatetest
65
+ $(MAKE) -f Developers.mk check-invisibles
65
66
 
66
67
  check:
67
68
  find lib -type f -exec grep --color -E ' $$' {} /dev/null \;
data/README-JA.md CHANGED
@@ -4,12 +4,6 @@
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)
6
6
 
7
- > [!IMPORTANT]
8
- > **2024年2月2日の時点でこのリポジトリのデフォルトブランチは[5-stable](https://github.com/sisimai/rb-sisimai/tree/5-stable)
9
- > (Sisimai 5)になりました。** もし古いバージョンを使いたい場合は[4-stable](https://github.com/sisimai/rb-sisimai/tree/4-stable)[^1]
10
- > ブランチを見てください。また`main`や`master`ブランチはもうこのリポジトリでは使用していません。
11
- [^1]: 4系を`clone`する場合は`git clone -b 4-stable https://github.com/sisimai/rb-sisimai.git`
12
-
13
7
  > [!CAUTION]
14
8
  > **Sisimai 4.25.17およびそれ以前の、Sisimai 5.7.1およびそれ以前のバージョンには 正規表現に関する脆弱性
15
9
  > [ReDoS: CVE-2022-4891](https://jvndb.jvn.jp/ja/contents/2022/JVNDB-2022-005663.html)と
@@ -17,6 +11,27 @@
17
11
  > 該当するバージョンをお使いの場合はv4.25.18またはv5.7.2以降へアップグレードしてください。**
18
12
 
19
13
  > [!WARNING]
14
+ > メモリ保護とシステムの安定性を確保するため、Sisimai 5.8.0よりUNIX mboxとメモリ(変数からの入力)と
15
+ > STDINから入るメール全体の容量を**2GB**に、Maildir/の各ファイルを含む個々のメールの最大値を**64MB**
16
+ > に、それぞれ制限するようになりました。
17
+
18
+ > [!NOTE]
19
+ > 現在の[Sisimai](https://libsisimai.org/ja/)には[Perl版](https://github.com/sisimai/p5-sisimai)と
20
+ > [Ruby版](https://github.com/sisimai/rb-sisimai)と[Go版](https://github.com/sisimai/go-sisimai)が
21
+ > あり、どれを使っても同じ結果が得られるように実装されています。開発体制は2025年の夏から解析精度や
22
+ > コードの堅牢さと厳格さを理由に[Go版](https://github.com/sisimai/go-sisimai)を原本としていて、
23
+ > [Perl版](https://github.com/sisimai/p5-sisimai)と[Ruby版](https://github.com/sisimai/rb-sisimai)
24
+ > は移植版という位置づけになっています。よって[Sisimai](https://github.com/sisimai)全体のバグや機能
25
+ > 追加などの開発状況は[Go版のIssues](https://github.com/sisimai/go-sisimai/issues)を参照してください。
26
+ > バグ報告については、それぞれお使いの言語版リポジトリのIssuesに書いてください。
27
+
28
+ > [!NOTE]
29
+ > **2024年2月2日の時点でこのリポジトリのデフォルトブランチは[5-stable](https://github.com/sisimai/rb-sisimai/tree/5-stable)
30
+ > (Sisimai 5)になりました。** もし古いバージョンを使いたい場合は[4-stable](https://github.com/sisimai/rb-sisimai/tree/4-stable)[^1]
31
+ > ブランチを見てください。また`main`や`master`ブランチはもうこのリポジトリでは使用していません。
32
+ [^1]: 4系を`clone`する場合は`git clone -b 4-stable https://github.com/sisimai/rb-sisimai.git`
33
+
34
+ > [!NOTE]
20
35
  > Sisimai 5はRuby 2.5以上が必要です。インストール/アップグレードを実行する前に`ruby -v`コマンドで
21
36
  > システムに入っているRubyのバージョンを確認してください。
22
37
 
@@ -117,10 +132,10 @@ Install
117
132
  ### From RubyGems.org
118
133
  ```shell
119
134
  $ sudo gem install sisimai
120
- Fetching: sisimai-5.7.2.gem (100%)
121
- Successfully installed sisimai-5.7.2
122
- Parsing documentation for sisimai-5.7.2
123
- Installing ri documentation for sisimai-5.7.2
135
+ Fetching: sisimai-5.8.0.gem (100%)
136
+ Successfully installed sisimai-5.8.0
137
+ Parsing documentation for sisimai-5.8.0
138
+ Installing ri documentation for sisimai-5.8.0
124
139
  Done installing documentation for sisimai after 6 seconds
125
140
  1 gem installed
126
141
  ```
@@ -148,13 +163,13 @@ if [ -d "/usr/local/jr" ]; then \
148
163
  ...
149
164
  3 gems installed
150
165
  /opt/local/bin/rake install
151
- sisimai 5.7.2 built to pkg/sisimai-5.7.2.gem.
152
- sisimai (5.7.2) installed.
166
+ sisimai 5.8.0 built to pkg/sisimai-5.8.0.gem.
167
+ sisimai (5.8.0) installed.
153
168
  if [ -d "/usr/local/jr" ]; then \
154
169
  PATH="/usr/local/jr/bin:$PATH" /usr/local/jr/bin/rake install; \
155
170
  fi
156
- sisimai 5.7.2 built to pkg/sisimai-5.7.2-java.gem.
157
- sisimai (5.7.2) installed.
171
+ sisimai 5.8.0 built to pkg/sisimai-5.8.0-java.gem.
172
+ sisimai (5.8.0) installed.
158
173
  ```
159
174
 
160
175
  Usage
@@ -363,7 +378,7 @@ Sisimai 5.5.0から**Ruby 2.5以上**が必要になります。
363
378
  | 解析エンジン(MTA/ESPモジュール)の数 | 68 | 60 |
364
379
  | 検出可能なバウンス理由の数 | 29 | 34 |
365
380
  | 依存Gem数(Ruby Standard Gemsを除く) | 1 Gem | 1 Gem |
366
- | ソースコードの行数 | 10,800 行 | 9,670 行 |
381
+ | ソースコードの行数 | 10,800 行 | 9,700 行 |
367
382
  | テストフレームワーク | rspec | minitest |
368
383
  | テスト件数(spec/またはtest/ディレクトリ) | 311,000 件 | 255,000 件 |
369
384
  | 1秒間に解析できるバウンスメール数[^4] | 620 通 | 620 通 |
data/README.md CHANGED
@@ -4,19 +4,34 @@
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)
6
6
 
7
- > [!IMPORTANT]
8
- > **The default branch of this repository is [5-stable](https://github.com/sisimai/rb-sisimai/tree/5-stable)
9
- > (Sisimai 5) since 2nd February 2024.**
10
- > If you want to clone the old version, see the [4-stable](https://github.com/sisimai/rb-sisimai/tree/4-stable)[^1]
11
- > branch instead. We have moved away from using both the `main` and `master` branches in our development process.
12
- [^1]: Specify `-b 4-stable` when you clone Sisimai 4 for example, `git clone -b 4-stable https://github.com/sisimai/rb-sisimai.git`
13
-
14
7
  > [!CAUTION]
15
8
  > **Sisimai versions 4.25.17 and earlier, as well as 5.7.1 and earlier, contain regular expression vulnerabilities
16
9
  > ([ReDoS: CVE-2022-4891](https://nvd.nist.gov/vuln/detail/CVE-2022-4891), ReDoS: CVE Pending).
17
10
  > If you are using affected versions, please upgrade to v4.25.18 or v5.7.2 or later.**
18
11
 
19
12
  > [!WARNING]
13
+ > To ensure memory protection and system stability, Starting with v5.8.0, Sisimai limits the total
14
+ > size of input data (such as a UNIX mbox, in-memory date from a variable, or STDIN) to **2GB**, and
15
+ > caps the maximum size of each individual email in Maildir/, UNIX mbox, memory, or STDIN at **64MB**.
16
+
17
+ > [!NOTE]
18
+ > [Sisimai](https://libsisimai.org/) is available in [Perl](https://github.com/sisimai/p5-sisimai),
19
+ > [Ruby](https://github.com/sisimai/rb-sisimai), and [Go](https://github.com/sisimai/go-sisimai),
20
+ > all designed to produce identical decoding results.
21
+ > As of summer 2025, the [Go version](https://github.com/sisimai/go-sisimai) serves as the primary
22
+ > implementation (Single Source of Truth) due to its strictness, code robustness, and high accuracy,
23
+ > while the Perl and Ruby versions are maintained as ports. Bug reports for specific languages should
24
+ > be submitted to their respective repositories. For overall development status and upcoming features,
25
+ > please refer to the [Go version's Issues](https://github.com/sisimai/go-sisimai/issues).
26
+
27
+ > [!NOTE]
28
+ > **The default branch of this repository is [5-stable](https://github.com/sisimai/rb-sisimai/tree/5-stable)
29
+ > (Sisimai 5) since 2nd February 2024.**
30
+ > If you want to clone the old version, see the [4-stable](https://github.com/sisimai/rb-sisimai/tree/4-stable)[^1]
31
+ > branch instead. We have moved away from using both the `main` and `master` branches in our development process.
32
+ [^1]: Specify `-b 4-stable` when you clone Sisimai 4 for example, `git clone -b 4-stable https://github.com/sisimai/rb-sisimai.git`
33
+
34
+ > [!NOTE]
20
35
  > Sisimai 5 requires Ruby 2.5 or later. Check the version of Ruby in your system before installing/upgrading
21
36
  > by `ruby -v` command.
22
37
 
@@ -115,10 +130,10 @@ Install
115
130
  ### From RubyGems
116
131
  ```shell
117
132
  $ sudo gem install sisimai
118
- Fetching: sisimai-5.7.2.gem (100%)
119
- Successfully installed sisimai-5.7.2
120
- Parsing documentation for sisimai-5.7.2
121
- Installing ri documentation for sisimai-5.7.2
133
+ Fetching: sisimai-5.8.0.gem (100%)
134
+ Successfully installed sisimai-5.8.0
135
+ Parsing documentation for sisimai-5.8.0
136
+ Installing ri documentation for sisimai-5.8.0
122
137
  Done installing documentation for sisimai after 6 seconds
123
138
  1 gem installed
124
139
  ```
@@ -146,13 +161,13 @@ if [ -d "/usr/local/jr" ]; then \
146
161
  ...
147
162
  3 gems installed
148
163
  /opt/local/bin/rake install
149
- sisimai 5.7.2 built to pkg/sisimai-5.7.2.gem.
150
- sisimai (5.7.2) installed.
164
+ sisimai 5.8.0 built to pkg/sisimai-5.8.0.gem.
165
+ sisimai (5.8.0) installed.
151
166
  if [ -d "/usr/local/jr" ]; then \
152
167
  PATH="/usr/local/jr/bin:$PATH" /usr/local/jr/bin/rake install; \
153
168
  fi
154
- sisimai 5.7.2 built to pkg/sisimai-5.7.2-java.gem.
155
- sisimai (5.7.2) installed.
169
+ sisimai 5.8.0 built to pkg/sisimai-5.8.0-java.gem.
170
+ sisimai (5.8.0) installed.
156
171
  ```
157
172
 
158
173
  Usage
@@ -361,7 +376,7 @@ Beginning with v5.5.0, Sisimai requires **Ruby 2.5.0 or later.**
361
376
  | The number of MTA/ESP modules | 68 | 61 |
362
377
  | The number of detectable bounce reasons | 29 | 34 |
363
378
  | Dependencies (Except Ruby Standard Gems) | 1 gem | 1 gem |
364
- | Source lines of code | 10,300 lines | 9,670 lines |
379
+ | Source lines of code | 10,300 lines | 9,700 lines |
365
380
  | Test frameworks | rspec | minitest |
366
381
  | The number of tests in spec/ or test/ directory | 311,000 tests | 255,000 tests |
367
382
  | The number of bounce emails decoded/sec (CRuby)[^4] | 620 emails | 620 emails |
data/lib/sisimai/arf.rb CHANGED
@@ -68,8 +68,8 @@ module Sisimai
68
68
  def inquire(mhead, mbody)
69
69
  return nil if self.is_arf(mhead) == false
70
70
 
71
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts[0].empty?
71
72
  dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = dscontents[-1]
72
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
73
73
  bodyslices = emailparts[0].split("\n")
74
74
  reportpart = false
75
75
  readcursor = 0 # Points the current cursor position
data/lib/sisimai/eb.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  module Sisimai
2
2
  # Sisimai::Eb - Package "eb" provides constants for the email bounce.
3
3
  module Eb
4
+ XeBYTE = 64 * 1024 * 1024; # 64MB: The maximum size of each email file in Maildir/, UNIX mbox.
5
+
4
6
  # _ ______
5
7
  # ___| |__ / / _ \ ___ __ _ ___ ___ _ __
6
8
  # / _ \ '_ \ / /| |_) / _ \/ _` / __|/ _ \| '_ \
@@ -20,9 +20,9 @@ module Sisimai::Lhost
20
20
  # :subject => %r/FAILURE NOTICE :/,
21
21
  return nil if mhead['x-ahmailid'].nil?
22
22
 
23
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
24
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
23
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
25
24
  bodyslices = emailparts[0].split("\n")
25
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
26
26
  readcursor = 0 # (Integer) Points the current cursor position
27
27
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
28
28
 
@@ -123,6 +123,7 @@ module Sisimai::Lhost
123
123
  require "sisimai/smtp/command"
124
124
  dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = dscontents[-1]
125
125
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
126
+ feedbackid = ''
126
127
  whatnotify = jsonobject["notificationType"][0, 1] || ""
127
128
 
128
129
  case whatnotify
@@ -146,6 +147,7 @@ module Sisimai::Lhost
146
147
  v["replycode"] = Sisimai::SMTP::Reply.find(v["diagnosis"], v["status"])
147
148
  v["date"] = p["timestamp"]
148
149
  v["lhost"] = Sisimai::RFC1123.find(p["reportingMTA"])
150
+ feedbackid = p["feedbackId"]
149
151
  recipients += 1
150
152
  end
151
153
 
@@ -169,6 +171,7 @@ module Sisimai::Lhost
169
171
  v["feedbacktype"] = p["complaintFeedbackType"]
170
172
  v["date"] = p["timestamp"]
171
173
  v["diagnosis"] = sprintf('"feedbackid":"%s", "useragent":"%s"}', p["feedbackId"], p["userAgent"])
174
+ feedbackid = p["feedbackId"]
172
175
  recipients += 1
173
176
  end
174
177
  when "D"
@@ -203,6 +206,7 @@ module Sisimai::Lhost
203
206
  dscontents.each { |e| e["date"] = e["date"].sub("T", " ").sub(/[.]\d{3}Z/, "") }
204
207
 
205
208
  cv = ""
209
+ cv = sprintf("Feedback-ID: %s\n", feedbackid) unless feedbackid.empty?
206
210
  jsonobject["mail"]["headers"].each do |e|
207
211
  cv += sprintf("%s: %s\n", e["name"], e["value"])
208
212
  end
@@ -26,9 +26,9 @@ module Sisimai::Lhost
26
26
  match += 1 if mhead["received"].any? { |a| a.include?("JAMES SMTP Server") }
27
27
  return nil if match == 0
28
28
 
29
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = dscontents[-1]
30
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
29
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
31
30
  bodyslices = emailparts[0].split("\n")
31
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = dscontents[-1]
32
32
  readcursor = 0 # Points the current cursor position
33
33
  recipients = 0 # The number of 'Final-Recipient' header
34
34
  alternates = ["", "", "", ""] # [Envelope-From, Header-From, Date, Subject]
@@ -22,9 +22,9 @@ module Sisimai::Lhost
22
22
  return nil if %w[biglobe inacatv tmtv ttv].none? { |a| mhead['from'].include?('@' + a + '.ne.jp') }
23
23
  return nil if mhead['subject'].start_with?('Returned mail:') == false
24
24
 
25
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
26
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
25
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
27
26
  bodyslices = emailparts[0].split("\n")
27
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
28
28
  readcursor = 0 # (Integer) Points the current cursor position
29
29
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
30
30
 
@@ -45,9 +45,9 @@ module Sisimai::Lhost
45
45
  fieldtable = Sisimai::RFC1894.FIELDTABLE
46
46
  permessage = {} # (Hash) Store values of each Per-Message field
47
47
 
48
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
49
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
48
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
50
49
  bodyslices = emailparts[0].split("\n")
50
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
51
51
  readslices = ['']
52
52
  readcursor = 0 # (Integer) Points the current cursor position
53
53
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
@@ -32,9 +32,9 @@ module Sisimai::Lhost
32
32
  # by mailout11.t-online.de (Postfix) with SMTP id 05E5A1CAC0
33
33
  # From: Mail Delivery System <Mailer-Daemon@t-online.de>
34
34
  # X-TOI-MSGID: c9412855-531f-497b-b007-5ffc033877a0
35
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
36
- emailparts = Sisimai::RFC5322.part(mbody, [BannerDTAG[3], BannerDTAG[2]])
35
+ emailparts = Sisimai::RFC5322.part(mbody, [BannerDTAG[3], BannerDTAG[2]]); return nil if emailparts.nil? || emailparts[0].empty?
37
36
  bodyslices = emailparts[0].split("\n")
37
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
38
38
  messagelog = ''
39
39
  readcursor = 0 # (Integer) Points the current cursor position
40
40
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
@@ -29,12 +29,11 @@ module Sisimai::Lhost
29
29
 
30
30
  require 'sisimai/rfc1123'
31
31
  require 'sisimai/rfc1894'
32
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
33
+ bodyslices = emailparts[0].split("\n")
34
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
32
35
  fieldtable = Sisimai::RFC1894.FIELDTABLE
33
36
  permessage = {} # (Hash) Store values of each Per-Message field
34
-
35
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
36
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
37
- bodyslices = emailparts[0].split("\n")
38
37
  readcursor = 0 # (Integer) Points the current cursor position
39
38
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
40
39
  subjecttxt = '' # (String) The value of Subject:
@@ -24,9 +24,9 @@ module Sisimai::Lhost
24
24
  return nil if mhead['subject'].start_with?('Mail delivery failed') == false
25
25
  return nil if mhead['received'].none? { |a| a.include?(' (DragonFly Mail Agent') }
26
26
 
27
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
28
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
27
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
29
28
  bodyslices = emailparts[0].split("\n")
29
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
30
30
  readcursor = 0 # (Integer) Points the current cursor position
31
31
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
32
32
 
@@ -22,9 +22,9 @@ module Sisimai::Lhost
22
22
  return nil if mhead['from'].start_with?('"Mail Delivery System"') == false
23
23
  return nil if mhead['subject'] != 'Mail delivery failed: returning message to sender'
24
24
 
25
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
26
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
25
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
27
26
  bodyslices = emailparts[0].split("\n")
27
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
28
28
  readcursor = 0 # (Integer) Points the current cursor position
29
29
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
30
30
 
@@ -84,9 +84,9 @@ module Sisimai::Lhost
84
84
  end
85
85
  return nil if match == 0
86
86
 
87
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
88
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
87
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
89
88
  bodyslices = emailparts[0].split("\n")
89
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
90
90
  readcursor = 0 # (Integer) Points the current cursor position
91
91
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
92
92
  statuspart = false # (Boolean) Flag, true = have got delivery status part.
@@ -74,9 +74,9 @@ module Sisimai::Lhost
74
74
  require "sisimai/rfc1123"
75
75
  require "sisimai/smtp/reply"
76
76
  require "sisimai/smtp/status"
77
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
78
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
77
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
79
78
  bodyslices = emailparts[0].split("\n")
79
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
80
80
  readcursor = 0 # (Integer) Points the current cursor position
81
81
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
82
82
 
@@ -129,9 +129,9 @@ module Sisimai::Lhost
129
129
  require "sisimai/smtp/command"
130
130
  require "sisimai/smtp/failure"
131
131
 
132
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
133
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
132
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
134
133
  bodyslices = emailparts[0].split("\n")
134
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
135
135
  readcursor = 0 # (Integer) Points the current cursor position
136
136
  nextcursor = false
137
137
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
@@ -33,10 +33,10 @@ module Sisimai::Lhost
33
33
  end
34
34
  return nil if match < 2
35
35
 
36
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
37
+ bodyslices = emailparts[0].split("\n")
36
38
  fieldtable = Sisimai::RFC1894.FIELDTABLE
37
39
  dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
38
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
39
- bodyslices = emailparts[0].split("\n")
40
40
  readcursor = 0 # (Integer) Points the current cursor position
41
41
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
42
42
 
@@ -35,9 +35,9 @@ module Sisimai::Lhost
35
35
  return nil if mhead['from'].include?('-admin@') == false
36
36
  return nil if mhead['message-id'].index('.FML') < 2
37
37
 
38
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
39
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
38
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
40
39
  bodyslices = emailparts[0].split("\n")
40
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
41
41
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
42
42
 
43
43
  while e = bodyslices.shift do
@@ -142,9 +142,9 @@ module Sisimai::Lhost
142
142
  return nil if mhead['subject'].start_with?('Delivery Status Notification') == false
143
143
 
144
144
  require 'sisimai/address'
145
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
146
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
145
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
147
146
  bodyslices = emailparts[0].split("\n")
147
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
148
148
  readcursor = 0 # (Integer) Points the current cursor position
149
149
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
150
150
 
@@ -22,9 +22,9 @@ module Sisimai::Lhost
22
22
  return nil if mhead['x-gmx-antispam'].nil?
23
23
 
24
24
  require 'sisimai/smtp/command'
25
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
26
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
25
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
27
26
  bodyslices = emailparts[0].split("\n")
27
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
28
28
  readcursor = 0 # (Integer) Points the current cursor position
29
29
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
30
30
 
@@ -36,8 +36,8 @@ module Sisimai::Lhost
36
36
  # Thanks,
37
37
  #
38
38
  # Google Groups
39
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
39
40
  dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = dscontents[-1]
40
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
41
41
  recipients = 0
42
42
 
43
43
  # * You might have spelled or formatted the group name incorrectly.
@@ -29,9 +29,9 @@ module Sisimai::Lhost
29
29
  return nil if mhead["from"].include?('<mailer-daemon@googlemail.com>') == false
30
30
  return nil if mhead["subject"].include?("Delivery Status Notification") == false
31
31
 
32
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
33
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
32
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
34
33
  bodyslices = emailparts[0].split("\n")
34
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
35
35
  entiremesg = ""
36
36
  readcursor = 0 # (Integer) Points the current cursor position
37
37
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
@@ -26,9 +26,9 @@ module Sisimai::Lhost
26
26
  match += 1 if mhead['x-mailer'].to_s.start_with?('<SMTP32 v')
27
27
  return nil if match == 0
28
28
 
29
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
30
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
29
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
31
30
  bodyslices = emailparts[0].split("\n")
31
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
32
32
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
33
33
 
34
34
  while e = bodyslices.shift do
@@ -24,9 +24,9 @@ module Sisimai::Lhost
24
24
  match += 1 if mhead['received'].any? { |a| a.include?('.au.com (') }
25
25
  return nil if match == 0
26
26
 
27
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
28
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
27
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
29
28
  bodyslices = emailparts[0].split("\n")
29
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
30
30
  readcursor = 0 # (Integer) Points the current cursor position
31
31
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
32
32
 
@@ -21,9 +21,9 @@ module Sisimai::Lhost
21
21
  return nil if mhead['subject'] != 'Message delivery has failed'
22
22
  return nil if mhead['received'].none? { |a| a.include?('(MAILFOUNDRY) id ') }
23
23
 
24
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
25
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
24
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
26
25
  bodyslices = emailparts[0].split("\n")
26
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
27
27
  readcursor = 0 # (Integer) Points the current cursor position
28
28
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
29
29
 
@@ -22,9 +22,9 @@ module Sisimai::Lhost
22
22
  def inquire(mhead, mbody)
23
23
  return nil if mhead['subject'].start_with?('Undeliverable Mail: "') == false
24
24
 
25
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
26
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
25
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
27
26
  bodyslices = emailparts[0].split("\n")
27
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
28
28
  readcursor = 0 # (Integer) Points the current cursor position
29
29
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
30
30
  endoferror = false # (Boolean) Flag for the end of error message
@@ -21,9 +21,9 @@ module Sisimai::Lhost
21
21
  match += 1 if mhead['subject'].start_with?('Delivery Notification: ')
22
22
  return nil if match == 0
23
23
 
24
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
25
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
24
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
26
25
  bodyslices = emailparts[0].split("\n")
26
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
27
27
  readcursor = 0 # (Integer) Points the current cursor position
28
28
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
29
29
 
@@ -26,9 +26,9 @@ module Sisimai::Lhost
26
26
  proceedsto = true if StartingOf[:command].any? { |a| mbody.include?(a) }
27
27
  return nil if proceedsto == false
28
28
 
29
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
30
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
29
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
31
30
  bodyslices = emailparts[0].split("\n")
31
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
32
32
  readcursor = 0 # (Integer) Points the current cursor position
33
33
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
34
34
  markingset = {'diagnosis' => false, 'command' => false}
@@ -28,9 +28,9 @@ module Sisimai::Lhost
28
28
  fieldtable = Sisimai::RFC1894.FIELDTABLE
29
29
  permessage = {} # (Hash) Store values of each Per-Message field
30
30
 
31
- dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
32
- emailparts = Sisimai::RFC5322.part(mbody, Boundaries)
31
+ emailparts = Sisimai::RFC5322.part(mbody, Boundaries); return nil if emailparts.nil? || emailparts[0].empty?
33
32
  bodyslices = emailparts[0].split("\n")
33
+ dscontents = [Sisimai::Lhost.DELIVERYSTATUS]; v = nil
34
34
  readcursor = 0 # (Integer) Points the current cursor position
35
35
  recipients = 0 # (Integer) The number of 'Final-Recipient' header
36
36