sisimai 5.0.0-java → 5.0.2-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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake-test.yml +55 -0
  3. data/ChangeLog.md +40 -1
  4. data/README-JA.md +223 -111
  5. data/README.md +54 -31
  6. data/lib/sisimai/fact.rb +46 -8
  7. data/lib/sisimai/lhost/amazonses.rb +0 -1
  8. data/lib/sisimai/lhost/amazonworkmail.rb +0 -1
  9. data/lib/sisimai/lhost/aol.rb +0 -1
  10. data/lib/sisimai/lhost/bigfoot.rb +0 -1
  11. data/lib/sisimai/lhost/domino.rb +0 -1
  12. data/lib/sisimai/lhost/exchange2007.rb +1 -1
  13. data/lib/sisimai/lhost/exim.rb +7 -16
  14. data/lib/sisimai/lhost/facebook.rb +0 -1
  15. data/lib/sisimai/lhost/googlegroups.rb +2 -1
  16. data/lib/sisimai/lhost/gsuite.rb +0 -1
  17. data/lib/sisimai/lhost/mailru.rb +8 -17
  18. data/lib/sisimai/lhost/messagelabs.rb +0 -1
  19. data/lib/sisimai/lhost/mfilter.rb +1 -1
  20. data/lib/sisimai/lhost/mxlogic.rb +8 -18
  21. data/lib/sisimai/lhost/office365.rb +1 -1
  22. data/lib/sisimai/lhost/outlook.rb +0 -1
  23. data/lib/sisimai/lhost/postfix.rb +0 -1
  24. data/lib/sisimai/lhost/receivingses.rb +0 -1
  25. data/lib/sisimai/lhost/sendgrid.rb +1 -3
  26. data/lib/sisimai/lhost/sendmail.rb +0 -1
  27. data/lib/sisimai/lhost/yandex.rb +0 -1
  28. data/lib/sisimai/message.rb +13 -4
  29. data/lib/sisimai/reason/authfailure.rb +1 -0
  30. data/lib/sisimai/reason/blocked.rb +2 -0
  31. data/lib/sisimai/reason/expired.rb +1 -0
  32. data/lib/sisimai/reason/mailboxfull.rb +1 -0
  33. data/lib/sisimai/reason/securityerror.rb +1 -0
  34. data/lib/sisimai/reason/spamdetected.rb +1 -0
  35. data/lib/sisimai/reason/suspend.rb +1 -0
  36. data/lib/sisimai/rfc5322.rb +120 -64
  37. data/lib/sisimai/rhost/google.rb +320 -59
  38. data/lib/sisimai/rhost/mimecast.rb +9 -2
  39. data/lib/sisimai/smtp/status.rb +3 -0
  40. data/lib/sisimai/version.rb +1 -1
  41. data/lib/sisimai.rb +12 -11
  42. data/set-of-emails/maildir/bsd/lhost-sendmail-60.eml +85 -0
  43. metadata +9 -7
data/lib/sisimai.rb CHANGED
@@ -1,5 +1,6 @@
1
- # Sisimai is a Ruby module for analyzing RFC5322 bounce emails and generating structured data from
2
- # parsed results.
1
+ # Sisimai is a library that decodes complex and diverse bounce emails and outputs the results of
2
+ # the delivery failure, such as the reason for the bounce and the recipient email address, in
3
+ # structured data. It is also possible to output in JSON format.
3
4
  require 'sisimai/version'
4
5
  module Sisimai
5
6
  class << self
@@ -12,15 +13,15 @@ module Sisimai
12
13
  return Sisimai.rise(argv0, **argv1)
13
14
  end
14
15
 
15
- # Wrapper method for parsing mailbox/maidir
16
+ # Wrapper method for decoding mailbox/maidir
16
17
  # @param [String] argv0 Path to mbox or Maildir/
17
18
  # @param [Hash] argv0 or Hash (decoded JSON)
18
19
  # @param [IO] argv0 or STDIN object
19
- # @param [Hash] argv1 Parser options(delivered=false)
20
+ # @param [Hash] argv1 Options for decoding(delivered=false)
20
21
  # @options argv1 [Boolean] delivered true: Include "delivered" reason
21
22
  # @options argv1 [Boolean] vacation true: Include "vacation" reason
22
23
  # @options argv1 [Array] c___ Proc object to a callback method for the message and each file
23
- # @return [Array] Parsed objects
24
+ # @return [Array] Decoded objects
24
25
  # @return [nil] nil if the argument was wrong or an empty array
25
26
  def rise(argv0, **argv1)
26
27
  return nil unless argv0
@@ -33,7 +34,7 @@ module Sisimai
33
34
  sisi = []
34
35
 
35
36
  while r = mail.data.read do
36
- # Read and parse each email file
37
+ # Read and decode each email file
37
38
  path = mail.data.path
38
39
  args = { data: r, hook: c___[0], origin: path, delivered: argv1[:delivered], vacation: argv1[:vacation] }
39
40
  fact = Sisimai::Fact.rise(**args) || []
@@ -56,15 +57,15 @@ module Sisimai
56
57
  return sisi
57
58
  end
58
59
 
59
- # Wrapper method to parse mailbox/Maildir and dump as JSON
60
+ # Wrapper method to decode mailbox/Maildir and dump as JSON
60
61
  # @param [String] argv0 Path to mbox or Maildir/
61
62
  # @param [Hash] argv0 or Hash (decoded JSON)
62
63
  # @param [IO] argv0 or STDIN object
63
- # @param [Hash] argv1 Parser options
64
+ # @param [Hash] argv1 Options for decoding
64
65
  # @options argv1 [Integer] delivered true: Include "delivered" reason
65
66
  # @options argv1 [Integer] vacation true: Include "vacation" reason
66
67
  # @options argv1 [Lambda] hook Lambda object to be called back
67
- # @return [String] Parsed data as JSON text
68
+ # @return [String] Decoded data as JSON text
68
69
  def dump(argv0, **argv1)
69
70
  return nil unless argv0
70
71
  nyaan = Sisimai.rise(argv0, **argv1) || []
@@ -80,8 +81,8 @@ module Sisimai
80
81
  return jsonstring
81
82
  end
82
83
 
83
- # Parser engine list (MTA modules)
84
- # @return [Hash] Parser engine table
84
+ # Decoding engine list (MTA modules)
85
+ # @return [Hash] Decoding engine table
85
86
  def engine
86
87
  table = {}
87
88
 
@@ -0,0 +1,85 @@
1
+ Return-Path: <>
2
+ X-Original-To: nekochan@email.example.jp
3
+ Delivered-To: mail@email.example.jp
4
+ Received: from mx311.ume.example.ne.jp (ip-192-0-2-25.us-east-1.compute.internal [192.0.2.25])
5
+ by mx1.email.example.jp (Postfix) with ESMTPS id Ln2ZS7LPwxzW4HMF
6
+ for <nekochan@email.example.jp>; Wed, 7 Feb 2024 23:34:45 +0900 (JST)
7
+ Received: from localhost (localhost)
8
+ by mx311.ume.example.ne.jp (8.16.1/8.16.1) id 3LGub1et091679;
9
+ Wed, 7 Feb 2024 23:34:45 +0900 (JST)
10
+ (envelope-from MAILER-DAEMON)
11
+ Date: Wed, 7 Feb 2024 23:34:45 +0900 (JST)
12
+ From: Mail Delivery Subsystem <MAILER-DAEMON@mx311.ume.example.ne.jp>
13
+ To: <nekochan@email.example.jp>
14
+ Message-Id: <202402072222.3LGub1et091679@mx311.ume.example.ne.jp>
15
+ MIME-Version: 1.0
16
+ Content-Type: multipart/report; report-type=delivery-status;
17
+ boundary="3LGub1et091679.1157497350/mx311.ume.example.ne.jp"
18
+ Subject: Returned mail: see transcript for details
19
+ Auto-Submitted: auto-generated (failure)
20
+
21
+ This is a MIME-encapsulated message
22
+
23
+ --3LGub1et091679.1157497350/mx311.ume.example.ne.jp
24
+
25
+ The original message was received at Wed, 7 Feb 2024 23:34:45 +0900 (JST)
26
+ from localhost [127.0.0.1]
27
+
28
+ ----- The following addresses had permanent fatal errors -----
29
+ <kijitora-cat@google.example.com>
30
+ (reason: 550-5.7.26 The MAIL FROM domain [email.example.jp] has an SPF record with a hard fail)
31
+
32
+ ----- Transcript of session follows -----
33
+ ... while talking to gmail-smtp-in.l.google.com.:
34
+ >>> DATA
35
+ <<< 550-5.7.26 The MAIL FROM domain [email.example.jp] has an SPF record with a hard fail
36
+ <<< 550-5.7.26 policy (-all) but it fails to pass SPF checks with the ip:
37
+ <<< 550-5.7.26 [203.0.113.22]. To best protect our users from spam and phishing,
38
+ <<< 550-5.7.26 the message has been blocked. For instructions on setting up
39
+ <<< 550-5.7.26 authentication, go to
40
+ <<< 550 5.7.26 https://support.google.com/mail/answer/81126#authentication q2.22 - gsmtp
41
+ 554 5.0.0 Service unavailable
42
+
43
+ --3LGub1et091679.1157497350/mx311.ume.example.ne.jp
44
+ Content-Type: message/delivery-status
45
+
46
+ Reporting-MTA: dns; mx311.ume.example.ne.jp
47
+ Arrival-Date: Wed, 7 Feb 2024 23:34:45 +0900 (JST)
48
+
49
+ Final-Recipient: RFC822; kijitora-cat@google.example.com
50
+ X-Actual-Recipient: rfc822; kijitora-cat@google.example.com
51
+ Action: failed
52
+ Status: 5.7.26
53
+ Remote-MTA: DNS; gmail-smtp-in.l.google.com
54
+ Diagnostic-Code: SMTP; 550-5.7.26 The MAIL FROM domain [email.example.jp] has an SPF record with a hard fail
55
+ Last-Attempt-Date: Wed, 7 Feb 2024 23:34:45 +0900 (JST)
56
+
57
+ --3LGub1et091679.1157497350/mx311.ume.example.ne.jp
58
+ Content-Type: message/rfc822
59
+
60
+ Return-Path: <nekochan@email.example.jp>
61
+ Received: from mx311.ume.example.ne.jp (localhost [127.0.0.1])
62
+ by mx311.ume.example.ne.jp (8.16.1/8.16.1) with ESMTP id ujmeV2ZG033926
63
+ for <kijitora-cat@google.example.com>; Wed, 7 Feb 2024 23:34:45 +0900 (JST)
64
+ (envelope-from nekochan@email.example.jp)
65
+ Received: (from kijitora@localhost)
66
+ by mx311.ume.example.ne.jp (8.16.1/8.16.1/Submit) id BJObadmZ060489
67
+ for kijitora-cat@google.example.com; Wed, 7 Feb 2024 23:34:45 +0900 (JST)
68
+ (envelope-from nekochan@email.example.jp)
69
+ Received: from relay1.email.example.jp (relay1.email.example.jp [192.168.168.168])
70
+ by mx311.ume.example.ne.jp (8.16.1/8.16.1) with ESMTPS id Mf73VCB9P8z4lM3b
71
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO)
72
+ for <neko@libsisimai.org>; Wed, 7 Feb 2024 23:34:45 +0900 (JST)
73
+ (envelope-from nekochan@email.example.jp)
74
+ Content-Type: text/plain; charset=us-ascii
75
+ Message-Id: <50ad190.20240207.2202@relay1.email.example.jp>
76
+ Content-Transfer-Encoding: 7bit
77
+ Subject: Nyaan
78
+ From: <nekochan@email.example.jp>
79
+ To: <neko@libsisimai.org>
80
+ Date: 7 Feb 2024 23:34:45 +0900
81
+ MIME-Version: 1.0
82
+
83
+ Nyaan?
84
+
85
+ --3LGub1et091679.1157497350/mx311.ume.example.ne.jp--
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sisimai
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.0.2
5
5
  platform: java
6
6
  authors:
7
7
  - azumakuniyuki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-15 00:00:00.000000000 Z
11
+ date: 2024-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -17,8 +17,8 @@ dependencies:
17
17
  - !ruby/object:Gem::Version
18
18
  version: '1.8'
19
19
  name: bundler
20
- prerelease: false
21
20
  type: :development
21
+ prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
@@ -31,8 +31,8 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: '10.0'
33
33
  name: rake
34
- prerelease: false
35
34
  type: :development
35
+ prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
@@ -45,8 +45,8 @@ dependencies:
45
45
  - !ruby/object:Gem::Version
46
46
  version: '5.0'
47
47
  name: minitest
48
- prerelease: false
49
48
  type: :development
49
+ prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
@@ -62,8 +62,8 @@ dependencies:
62
62
  - !ruby/object:Gem::Version
63
63
  version: 0.3.8
64
64
  name: jrjackson
65
- prerelease: false
66
65
  type: :runtime
66
+ prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - "~>"
@@ -80,6 +80,7 @@ executables: []
80
80
  extensions: []
81
81
  extra_rdoc_files: []
82
82
  files:
83
+ - ".github/workflows/rake-test.yml"
83
84
  - ".gitignore"
84
85
  - ".rubocop.yml"
85
86
  - ".travis.yml"
@@ -646,6 +647,7 @@ files:
646
647
  - set-of-emails/maildir/bsd/lhost-sendmail-57.eml
647
648
  - set-of-emails/maildir/bsd/lhost-sendmail-58.eml
648
649
  - set-of-emails/maildir/bsd/lhost-sendmail-59.eml
650
+ - set-of-emails/maildir/bsd/lhost-sendmail-60.eml
649
651
  - set-of-emails/maildir/bsd/lhost-surfcontrol-01.eml
650
652
  - set-of-emails/maildir/bsd/lhost-surfcontrol-02.eml
651
653
  - set-of-emails/maildir/bsd/lhost-surfcontrol-03.eml
@@ -951,7 +953,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
951
953
  - !ruby/object:Gem::Version
952
954
  version: '0'
953
955
  requirements: []
954
- rubygems_version: 3.2.29
956
+ rubygems_version: 3.3.26
955
957
  signing_key:
956
958
  specification_version: 4
957
959
  summary: Mail Analyzing Interface