sisimai 5.0.0 → 5.0.2
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.
- checksums.yaml +4 -4
- data/.github/workflows/rake-test.yml +55 -0
- data/ChangeLog.md +40 -1
- data/README-JA.md +223 -111
- data/README.md +54 -31
- data/lib/sisimai/fact.rb +46 -8
- data/lib/sisimai/lhost/amazonses.rb +0 -1
- data/lib/sisimai/lhost/amazonworkmail.rb +0 -1
- data/lib/sisimai/lhost/aol.rb +0 -1
- data/lib/sisimai/lhost/bigfoot.rb +0 -1
- data/lib/sisimai/lhost/domino.rb +0 -1
- data/lib/sisimai/lhost/exchange2007.rb +1 -1
- data/lib/sisimai/lhost/exim.rb +7 -16
- data/lib/sisimai/lhost/facebook.rb +0 -1
- data/lib/sisimai/lhost/googlegroups.rb +2 -1
- data/lib/sisimai/lhost/gsuite.rb +0 -1
- data/lib/sisimai/lhost/mailru.rb +8 -17
- data/lib/sisimai/lhost/messagelabs.rb +0 -1
- data/lib/sisimai/lhost/mfilter.rb +1 -1
- data/lib/sisimai/lhost/mxlogic.rb +8 -18
- data/lib/sisimai/lhost/office365.rb +1 -1
- data/lib/sisimai/lhost/outlook.rb +0 -1
- data/lib/sisimai/lhost/postfix.rb +0 -1
- data/lib/sisimai/lhost/receivingses.rb +0 -1
- data/lib/sisimai/lhost/sendgrid.rb +1 -3
- data/lib/sisimai/lhost/sendmail.rb +0 -1
- data/lib/sisimai/lhost/yandex.rb +0 -1
- data/lib/sisimai/message.rb +13 -4
- data/lib/sisimai/reason/authfailure.rb +1 -0
- data/lib/sisimai/reason/blocked.rb +2 -0
- data/lib/sisimai/reason/expired.rb +1 -0
- data/lib/sisimai/reason/mailboxfull.rb +1 -0
- data/lib/sisimai/reason/securityerror.rb +1 -0
- data/lib/sisimai/reason/spamdetected.rb +1 -0
- data/lib/sisimai/reason/suspend.rb +1 -0
- data/lib/sisimai/rfc5322.rb +120 -64
- data/lib/sisimai/rhost/google.rb +320 -59
- data/lib/sisimai/rhost/mimecast.rb +9 -2
- data/lib/sisimai/smtp/status.rb +3 -0
- data/lib/sisimai/version.rb +1 -1
- data/lib/sisimai.rb +12 -11
- data/set-of-emails/maildir/bsd/lhost-sendmail-60.eml +85 -0
- metadata +4 -2
data/lib/sisimai.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Sisimai is a
|
2
|
-
#
|
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
|
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
|
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]
|
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
|
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
|
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
|
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]
|
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
|
-
#
|
84
|
-
# @return [Hash]
|
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.
|
4
|
+
version: 5.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- azumakuniyuki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -74,6 +74,7 @@ executables: []
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
+
- ".github/workflows/rake-test.yml"
|
77
78
|
- ".gitignore"
|
78
79
|
- ".rubocop.yml"
|
79
80
|
- ".travis.yml"
|
@@ -640,6 +641,7 @@ files:
|
|
640
641
|
- set-of-emails/maildir/bsd/lhost-sendmail-57.eml
|
641
642
|
- set-of-emails/maildir/bsd/lhost-sendmail-58.eml
|
642
643
|
- set-of-emails/maildir/bsd/lhost-sendmail-59.eml
|
644
|
+
- set-of-emails/maildir/bsd/lhost-sendmail-60.eml
|
643
645
|
- set-of-emails/maildir/bsd/lhost-surfcontrol-01.eml
|
644
646
|
- set-of-emails/maildir/bsd/lhost-surfcontrol-02.eml
|
645
647
|
- set-of-emails/maildir/bsd/lhost-surfcontrol-03.eml
|