sisimai 4.22.1 → 4.22.2
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.
- checksums.yaml +4 -4
- data/ChangeLog.md +21 -0
- data/README-JA.md +2 -2
- data/README.md +2 -2
- data/lib/sisimai.rb +2 -3
- data/lib/sisimai/address.rb +20 -40
- data/lib/sisimai/arf.rb +4 -4
- data/lib/sisimai/bite.rb +1 -0
- data/lib/sisimai/bite/email.rb +3 -4
- data/lib/sisimai/bite/email/activehunter.rb +7 -7
- data/lib/sisimai/bite/email/amazonses.rb +14 -14
- data/lib/sisimai/bite/email/amazonworkmail.rb +7 -7
- data/lib/sisimai/bite/email/aol.rb +8 -8
- data/lib/sisimai/bite/email/apachejames.rb +7 -7
- data/lib/sisimai/bite/email/bigfoot.rb +7 -7
- data/lib/sisimai/bite/email/biglobe.rb +7 -7
- data/lib/sisimai/bite/email/courier.rb +9 -9
- data/lib/sisimai/bite/email/domino.rb +8 -8
- data/lib/sisimai/bite/email/einsundeins.rb +7 -7
- data/lib/sisimai/bite/email/exchange2003.rb +10 -10
- data/lib/sisimai/bite/email/exchange2007.rb +10 -10
- data/lib/sisimai/bite/email/exim.rb +18 -19
- data/lib/sisimai/bite/email/ezweb.rb +9 -11
- data/lib/sisimai/bite/email/facebook.rb +22 -23
- data/lib/sisimai/bite/email/gmx.rb +7 -7
- data/lib/sisimai/bite/email/google.rb +22 -25
- data/lib/sisimai/bite/email/gsuite.rb +17 -19
- data/lib/sisimai/bite/email/imailserver.rb +13 -13
- data/lib/sisimai/bite/email/interscanmss.rb +7 -7
- data/lib/sisimai/bite/email/kddi.rb +7 -7
- data/lib/sisimai/bite/email/mailfoundry.rb +6 -6
- data/lib/sisimai/bite/email/mailmarshalsmtp.rb +13 -13
- data/lib/sisimai/bite/email/mailru.rb +10 -10
- data/lib/sisimai/bite/email/mcafee.rb +7 -7
- data/lib/sisimai/bite/email/messagelabs.rb +9 -9
- data/lib/sisimai/bite/email/messagingserver.rb +8 -8
- data/lib/sisimai/bite/email/mfilter.rb +7 -7
- data/lib/sisimai/bite/email/mxlogic.rb +9 -9
- data/lib/sisimai/bite/email/notes.rb +12 -12
- data/lib/sisimai/bite/email/office365.rb +14 -15
- data/lib/sisimai/bite/email/opensmtpd.rb +7 -7
- data/lib/sisimai/bite/email/outlook.rb +9 -9
- data/lib/sisimai/bite/email/postfix.rb +13 -13
- data/lib/sisimai/bite/email/qmail.rb +9 -9
- data/lib/sisimai/bite/email/receivingses.rb +9 -9
- data/lib/sisimai/bite/email/sendgrid.rb +9 -9
- data/lib/sisimai/bite/email/sendmail.rb +7 -7
- data/lib/sisimai/bite/email/surfcontrol.rb +7 -7
- data/lib/sisimai/bite/email/userdefined.rb +7 -7
- data/lib/sisimai/bite/email/v5sendmail.rb +21 -22
- data/lib/sisimai/bite/email/verizon.rb +8 -8
- data/lib/sisimai/bite/email/x1.rb +6 -6
- data/lib/sisimai/bite/email/x2.rb +6 -6
- data/lib/sisimai/bite/email/x3.rb +6 -6
- data/lib/sisimai/bite/email/x4.rb +9 -9
- data/lib/sisimai/bite/email/x5.rb +6 -6
- data/lib/sisimai/bite/email/yahoo.rb +7 -7
- data/lib/sisimai/bite/email/yandex.rb +7 -7
- data/lib/sisimai/bite/email/zoho.rb +8 -8
- data/lib/sisimai/bite/json.rb +10 -11
- data/lib/sisimai/bite/json/amazonses.rb +11 -11
- data/lib/sisimai/bite/json/sendgrid.rb +67 -17
- data/lib/sisimai/data.rb +19 -21
- data/lib/sisimai/data/json.rb +3 -3
- data/lib/sisimai/data/yaml.rb +3 -3
- data/lib/sisimai/datetime.rb +18 -21
- data/lib/sisimai/mail.rb +1 -1
- data/lib/sisimai/mail/stdin.rb +2 -2
- data/lib/sisimai/mda.rb +4 -4
- data/lib/sisimai/message.rb +1 -1
- data/lib/sisimai/message/email.rb +32 -35
- data/lib/sisimai/message/json.rb +3 -3
- data/lib/sisimai/mime.rb +5 -6
- data/lib/sisimai/order/email.rb +11 -11
- data/lib/sisimai/order/json.rb +3 -3
- data/lib/sisimai/reason.rb +2 -2
- data/lib/sisimai/reason/userunknown.rb +4 -5
- data/lib/sisimai/rfc3464.rb +14 -16
- data/lib/sisimai/rfc3834.rb +5 -5
- data/lib/sisimai/rfc5322.rb +2 -2
- data/lib/sisimai/rhost.rb +6 -5
- data/lib/sisimai/rhost/exchangeonline.rb +1 -1
- data/lib/sisimai/rhost/godaddy.rb +87 -0
- data/lib/sisimai/rhost/googleapps.rb +1 -1
- data/lib/sisimai/smtp/error.rb +21 -27
- data/lib/sisimai/smtp/status.rb +2 -2
- data/lib/sisimai/string.rb +7 -7
- data/lib/sisimai/version.rb +1 -1
- data/set-of-emails/jsonobj/json-sendgrid-12.json +1 -0
- data/set-of-emails/jsonobj/json-sendgrid-13.json +1 -0
- data/set-of-emails/jsonobj/json-sendgrid-14.json +1 -0
- data/set-of-emails/jsonobj/json-sendgrid-15.json +1 -0
- data/set-of-emails/jsonobj/json-sendgrid-16.json +1 -0
- data/set-of-emails/jsonobj/json-sendgrid-17.json +1 -0
- data/set-of-emails/maildir/bsd/rhost-godaddy-01.eml +83 -0
- data/set-of-emails/maildir/bsd/rhost-godaddy-02.eml +69 -0
- metadata +12 -6
- data/lib/sisimai/ced.rb +0 -48
- data/lib/sisimai/msp.rb +0 -39
- data/lib/sisimai/mta.rb +0 -39
data/lib/sisimai/mail.rb
CHANGED
@@ -15,7 +15,7 @@ module Sisimai
|
|
15
15
|
|
16
16
|
# Constructor of Sisimai::Mail
|
17
17
|
# @param [String] argv1 Path to mbox or Maildir/
|
18
|
-
# @return [Sisimai::Mail, Nil] Object or
|
18
|
+
# @return [Sisimai::Mail, Nil] Object or nil if the argument was wrong
|
19
19
|
def initialize(argv1)
|
20
20
|
classname = nil
|
21
21
|
parameter = { 'path' => argv1, 'type' => nil, 'mail' => nil }
|
data/lib/sisimai/mail/stdin.rb
CHANGED
@@ -13,8 +13,8 @@ module Sisimai
|
|
13
13
|
:offset, # [Integer] Offset position for seeking
|
14
14
|
:handle, # [IO::File] File handle
|
15
15
|
]
|
16
|
-
@@roaccessors.each
|
17
|
-
@@rwaccessors.each
|
16
|
+
@@roaccessors.each { |e| attr_reader e }
|
17
|
+
@@rwaccessors.each { |e| attr_accessor e }
|
18
18
|
|
19
19
|
# Constructor of Sisimai::Mail::STDIN
|
20
20
|
# @param [IO::STDIN] stdin Standard-In
|
data/lib/sisimai/mda.rb
CHANGED
@@ -5,7 +5,7 @@ module Sisimai
|
|
5
5
|
class << self
|
6
6
|
Re0 = {
|
7
7
|
:from => %r/\A(?:Mail Delivery Subsystem|MAILER-DAEMON|postmaster)/i,
|
8
|
-
}
|
8
|
+
}.freeze
|
9
9
|
Re1 = {
|
10
10
|
# dovecot/src/deliver/deliver.c
|
11
11
|
# 11: #define DEFAULT_MAIL_REJECTION_HUMAN_REASON \
|
@@ -16,7 +16,7 @@ module Sisimai
|
|
16
16
|
:'maildrop' => %r/\Amaildrop: /,
|
17
17
|
:'vpopmail' => %r/\Avdelivermail: /,
|
18
18
|
:'vmailmgr' => %r/\Avdeliver: /,
|
19
|
-
}
|
19
|
+
}.freeze
|
20
20
|
Re2 = %r{\A(?>
|
21
21
|
Your[ ]message[ ]to[ ].+[ ]was[ ]automatically[ ]rejected:\z
|
22
22
|
|(?:mail[.]local|procmail|maildrop|vdelivermail|vdeliver):[ ]
|
@@ -78,7 +78,7 @@ module Sisimai
|
|
78
78
|
}ix,
|
79
79
|
:mailboxfull => %r/Delivery failed due to system quota violation/i,
|
80
80
|
},
|
81
|
-
}
|
81
|
+
}.freeze
|
82
82
|
|
83
83
|
# Parse message body and return reason and text
|
84
84
|
# @param [Hash] mhead Message header of a bounce email
|
@@ -89,7 +89,7 @@ module Sisimai
|
|
89
89
|
# @options mhead [String] others Other required headers
|
90
90
|
# @param [String] mbody Message body of a bounce email
|
91
91
|
# @return [Hash, Nil] Bounce data list and message/rfc822 part
|
92
|
-
# or
|
92
|
+
# or nil if it failed to parse or the
|
93
93
|
# arguments are missing
|
94
94
|
def scan(mhead, mbody)
|
95
95
|
return nil unless mhead
|
data/lib/sisimai/message.rb
CHANGED
@@ -29,7 +29,7 @@ module Sisimai
|
|
29
29
|
# @options argvs [Array] :field Email header names to be captured
|
30
30
|
# @options argvs [Array] :order The order of MTA modules
|
31
31
|
# @options argvs [Code] :hook Reference to callback method
|
32
|
-
# @return [Sisimai::Message] Structured email data or
|
32
|
+
# @return [Sisimai::Message] Structured email data or nil if each
|
33
33
|
# value of the arguments are missing
|
34
34
|
def initialize(data: '', **argvs)
|
35
35
|
return nil if data.empty?
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Sisimai
|
2
|
-
# Sisimai::Message::Email convert bounce email text to data structure. It
|
3
|
-
# resolves an email text into an UNIX From line, the header part of the mail,
|
4
|
-
# delivery status, and RFC822 header part. When the email given as a argument
|
5
|
-
# of "new" method is not a bounce email, the method returns nil.
|
6
2
|
class Message
|
3
|
+
# Sisimai::Message::Email convert bounce email text to data structure. It
|
4
|
+
# resolves an email text into an UNIX From line, the header part of the mail,
|
5
|
+
# delivery status, and RFC822 header part. When the email given as a argument
|
6
|
+
# of "new" method is not a bounce email, the method returns nil.
|
7
7
|
class Email
|
8
8
|
# Imported from p5-Sisimail/lib/Sisimai/Message/Email.pm
|
9
9
|
require 'sisimai/arf'
|
@@ -18,17 +18,17 @@ module Sisimai
|
|
18
18
|
|
19
19
|
EndOfEmail = Sisimai::String.EOM
|
20
20
|
RFC822Head = Sisimai::RFC5322.HEADERFIELDS
|
21
|
-
RFC3834Set = Sisimai::RFC3834.headerlist.map
|
21
|
+
RFC3834Set = Sisimai::RFC3834.headerlist.map(&:downcase)
|
22
22
|
HeaderList = [
|
23
23
|
'from', 'to', 'date', 'subject', 'content-type', 'reply-to', 'message-id',
|
24
24
|
'received', 'content-transfer-encoding', 'return-path', 'x-mailer',
|
25
|
-
]
|
26
|
-
MultiHeads = { 'received' => true }
|
27
|
-
IgnoreList = { 'dkim-signature' => true }
|
25
|
+
].freeze
|
26
|
+
MultiHeads = { 'received' => true }.freeze
|
27
|
+
IgnoreList = { 'dkim-signature' => true }.freeze
|
28
28
|
Indicators = {
|
29
29
|
:begin => (1 << 1),
|
30
30
|
:endof => (1 << 2),
|
31
|
-
}
|
31
|
+
}.freeze
|
32
32
|
DefaultSet = Sisimai::Order::Email.another
|
33
33
|
SubjectTab = Sisimai::Order::Email.by('subject')
|
34
34
|
ExtHeaders = Sisimai::Order::Email.headers
|
@@ -95,14 +95,13 @@ module Sisimai
|
|
95
95
|
rfc822part = bouncedata['rfc822']
|
96
96
|
rfc822part = aftersplit['body'] if rfc822part.empty?
|
97
97
|
|
98
|
-
if rfc822part.is_a? ::String
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
98
|
+
processing['rfc822'] = if rfc822part.is_a? ::String
|
99
|
+
# The value returned from Sisimai::Bite::Email::* modules
|
100
|
+
Sisimai::Message::Email.takeapart(rfc822part)
|
101
|
+
else
|
102
|
+
# The value returned from Sisimai::Bite::JSON::* modules
|
103
|
+
rfc822part
|
104
|
+
end
|
106
105
|
return processing
|
107
106
|
end
|
108
107
|
|
@@ -333,14 +332,13 @@ module Sisimai
|
|
333
332
|
# Concatenate the line if it is the value of required header
|
334
333
|
if Sisimai::MIME.is_mimeencoded(e)
|
335
334
|
# The line is MIME-Encoded test
|
336
|
-
if previousfn == 'subject'
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
end
|
335
|
+
takenapart[previousfn] += if previousfn == 'subject'
|
336
|
+
# Subject: header
|
337
|
+
borderline + e
|
338
|
+
else
|
339
|
+
# Is not Subject header
|
340
|
+
e
|
341
|
+
end
|
344
342
|
mimeborder[previousfn] = true
|
345
343
|
|
346
344
|
else
|
@@ -365,7 +363,7 @@ module Sisimai
|
|
365
363
|
# MIME-Encoded subject field or ASCII characters only
|
366
364
|
r = []
|
367
365
|
if mimeborder['subject']
|
368
|
-
# split the value of Subject by
|
366
|
+
# split the value of Subject by borderline
|
369
367
|
v.split(borderline).each do |m|
|
370
368
|
# Insert value to the array if the string is MIME encoded text
|
371
369
|
r << m if Sisimai::MIME.is_mimeencoded(m)
|
@@ -419,14 +417,13 @@ module Sisimai
|
|
419
417
|
if ctencoding == 'base64' || ctencoding == 'quoted-printable'
|
420
418
|
# Content-Transfer-Encoding: base64
|
421
419
|
# Content-Transfer-Encoding: quoted-printable
|
422
|
-
if ctencoding == 'base64'
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
end
|
420
|
+
bodystring = if ctencoding == 'base64'
|
421
|
+
# Content-Transfer-Encoding: base64
|
422
|
+
Sisimai::MIME.base64d(bodystring)
|
423
|
+
else
|
424
|
+
# Content-Transfer-Encoding: quoted-printable
|
425
|
+
Sisimai::MIME.qprintd(bodystring)
|
426
|
+
end
|
430
427
|
end
|
431
428
|
|
432
429
|
if mesgformat =~ %r|text/html;?|
|
@@ -463,7 +460,7 @@ module Sisimai
|
|
463
460
|
}
|
464
461
|
havecaught = hookmethod.call(p)
|
465
462
|
rescue StandardError => ce
|
466
|
-
warn sprintf(
|
463
|
+
warn sprintf(' ***warning: Something is wrong in hook method :%s', ce.to_s)
|
467
464
|
end
|
468
465
|
end
|
469
466
|
|
data/lib/sisimai/message/json.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Sisimai
|
2
|
-
# Sisimai::Message::JSON convert from a bounce object (decoded JSON) which is
|
3
|
-
# retrieved from some Cloud Email Deliveries API to data structure.
|
4
2
|
class Message
|
3
|
+
# Sisimai::Message::JSON convert from a bounce object (decoded JSON) which is
|
4
|
+
# retrieved from some Cloud Email Deliveries API to data structure.
|
5
5
|
class JSON
|
6
6
|
# Imported from p5-Sisimail/lib/Sisimai/Message/JSON.pm
|
7
7
|
require 'sisimai/order/json'
|
@@ -134,7 +134,7 @@ module Sisimai
|
|
134
134
|
}
|
135
135
|
havecaught = hookmethod.call(p)
|
136
136
|
rescue StandardError => ce
|
137
|
-
warn sprintf(
|
137
|
+
warn sprintf(' ***warning: Something is wrong in hook method :%s', ce.to_s)
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
data/lib/sisimai/mime.rb
CHANGED
@@ -13,7 +13,7 @@ module Sisimai
|
|
13
13
|
:'with-charset' => %r/^Content[-]Type:[ ]*.+[;][ ]*charset=['"]?(.+?)['"]?$/i,
|
14
14
|
:'only-charset' => %r/^[\s\t]+charset=['"]?(.+?)['"]?$/i,
|
15
15
|
:'html-message' => %r|^Content-Type:[ ]*text/html;|mi,
|
16
|
-
}
|
16
|
+
}.freeze
|
17
17
|
|
18
18
|
# Make MIME-Encoding and Content-Type related headers regurlar expression
|
19
19
|
# @return [Array] Regular expressions related to MIME encoding
|
@@ -64,7 +64,7 @@ module Sisimai
|
|
64
64
|
|
65
65
|
argvs.each do |e|
|
66
66
|
# Check and decode each element
|
67
|
-
e = e.
|
67
|
+
e = e.strip
|
68
68
|
e = e.delete('"')
|
69
69
|
|
70
70
|
if self.is_mimeencoded(e)
|
@@ -98,9 +98,9 @@ module Sisimai
|
|
98
98
|
|
99
99
|
if characterset && encodingname
|
100
100
|
# utf8 => UTF-8
|
101
|
-
characterset = 'UTF-8' if characterset.
|
101
|
+
characterset = 'UTF-8' if characterset.casecmp('UTF8').zero?
|
102
102
|
|
103
|
-
|
103
|
+
unless characterset.casecmp('UTF-8').zero?
|
104
104
|
# Characterset is not UTF-8
|
105
105
|
begin
|
106
106
|
decodedtext1 = decodedtext1.encode('UTF-8', characterset)
|
@@ -182,8 +182,7 @@ module Sisimai
|
|
182
182
|
:until => Regexp.new(Regexp.escape(boundary01) + '\z')
|
183
183
|
}
|
184
184
|
end
|
185
|
-
elsif cv = e.match(ReE[:'with-charset']) ||
|
186
|
-
cv = e.match(ReE[:'only-charset'])
|
185
|
+
elsif cv = e.match(ReE[:'with-charset']) || e.match(ReE[:'only-charset'])
|
187
186
|
# Content-Type: text/plain; charset=ISO-2022-JP
|
188
187
|
encodename = cv[1]
|
189
188
|
mimeinside = true if ctencoding
|
data/lib/sisimai/order/email.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Sisimai
|
2
|
-
# Sisimai::Order::Email makes optimized order list which include MTA modules
|
3
|
-
# to be loaded on first from MTA specific headers in the bounce mail headers
|
4
|
-
# such as X-Failed-Recipients.
|
5
|
-
# This module are called from only Sisimai::Message::Email.
|
6
2
|
module Order
|
3
|
+
# Sisimai::Order::Email makes optimized order list which include MTA modules
|
4
|
+
# to be loaded on first from MTA specific headers in the bounce mail headers
|
5
|
+
# such as X-Failed-Recipients.
|
6
|
+
# This module are called from only Sisimai::Message::Email.
|
7
7
|
module Email
|
8
8
|
# Imported from p5-Sisimail/lib/Sisimai/Order/Email.pm
|
9
9
|
class << self
|
@@ -14,14 +14,14 @@ module Sisimai
|
|
14
14
|
# which is hard to code as regular expression
|
15
15
|
'Sisimai::Bite::Email::Exim',
|
16
16
|
'Sisimai::Bite::Email::Exchange2003',
|
17
|
-
]
|
17
|
+
].freeze
|
18
18
|
EngineOrder2 = [
|
19
19
|
# These modules have no MTA specific header and did not listed in the
|
20
20
|
# following subject header based regular expressions.
|
21
21
|
'Sisimai::Bite::Email::Exchange2007',
|
22
22
|
'Sisimai::Bite::Email::Facebook',
|
23
23
|
'Sisimai::Bite::Email::KDDI',
|
24
|
-
]
|
24
|
+
].freeze
|
25
25
|
EngineOrder3 = [
|
26
26
|
# These modules have no MTA specific header but listed in the following
|
27
27
|
# subject header based regular expressions.
|
@@ -39,7 +39,7 @@ module Sisimai
|
|
39
39
|
'Sisimai::Bite::Email::SendGrid',
|
40
40
|
'Sisimai::Bite::Email::Bigfoot',
|
41
41
|
'Sisimai::Bite::Email::X4',
|
42
|
-
]
|
42
|
+
].freeze
|
43
43
|
EngineOrder4 = [
|
44
44
|
# These modules have no MTA specific headers and there are few samples or
|
45
45
|
# too old MTA
|
@@ -54,7 +54,7 @@ module Sisimai
|
|
54
54
|
'Sisimai::Bite::Email::X2',
|
55
55
|
'Sisimai::Bite::Email::X1',
|
56
56
|
'Sisimai::Bite::Email::V5sendmail',
|
57
|
-
]
|
57
|
+
].freeze
|
58
58
|
EngineOrder5 = [
|
59
59
|
# These modules have one or more MTA specific headers but other headers
|
60
60
|
# also required for detecting MTA name
|
@@ -64,7 +64,7 @@ module Sisimai
|
|
64
64
|
'Sisimai::Bite::Email::MessageLabs',
|
65
65
|
'Sisimai::Bite::Email::MailMarshalSMTP',
|
66
66
|
'Sisimai::Bite::Email::MFILTER',
|
67
|
-
]
|
67
|
+
].freeze
|
68
68
|
EngineOrder9 = [
|
69
69
|
# These modules have one or more MTA specific headers
|
70
70
|
'Sisimai::Bite::Email::Aol',
|
@@ -79,7 +79,7 @@ module Sisimai
|
|
79
79
|
'Sisimai::Bite::Email::McAfee',
|
80
80
|
'Sisimai::Bite::Email::Activehunter',
|
81
81
|
'Sisimai::Bite::Email::SurfControl',
|
82
|
-
]
|
82
|
+
].freeze
|
83
83
|
|
84
84
|
# This variable don't hold MTA name which have one or more MTA specific
|
85
85
|
# header such as X-AWS-Outgoing, X-Yandex-Uniq.
|
@@ -148,7 +148,7 @@ module Sisimai
|
|
148
148
|
'Sisimai::Bite::Email::Exim',
|
149
149
|
],
|
150
150
|
},
|
151
|
-
}
|
151
|
+
}.freeze
|
152
152
|
|
153
153
|
make_default_order = lambda do
|
154
154
|
# Make default order of MTA modules to be loaded
|
data/lib/sisimai/order/json.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Sisimai
|
2
|
-
# Sisimai::Order::JSON - Make optimized order list for calling MTA modules
|
3
|
-
# for JSON formatted bounce objects
|
4
2
|
module Order
|
3
|
+
# Sisimai::Order::JSON - Make optimized order list for calling MTA modules
|
4
|
+
# for JSON formatted bounce objects
|
5
5
|
module JSON
|
6
6
|
# Imported from p5-Sisimail/lib/Sisimai/Order/JSON.pm
|
7
7
|
class << self
|
@@ -13,7 +13,7 @@ module Sisimai
|
|
13
13
|
'Sisimai::Bite::JSON::AmazonSES',
|
14
14
|
],
|
15
15
|
},
|
16
|
-
}
|
16
|
+
}.freeze
|
17
17
|
|
18
18
|
make_default_order = lambda do
|
19
19
|
# Make default order of MTA(JSON) modules to be loaded
|
data/lib/sisimai/reason.rb
CHANGED
@@ -86,7 +86,7 @@ module Sisimai
|
|
86
86
|
|
87
87
|
# Detect the other bounce reason, fall back method for get()
|
88
88
|
# @param [Sisimai::Data] argvs Parsed email object
|
89
|
-
# @return [String,
|
89
|
+
# @return [String, Nil] Bounce reason or nli if the argument
|
90
90
|
# is missing or invalid object
|
91
91
|
# @see get
|
92
92
|
def anotherone(argvs)
|
@@ -207,7 +207,7 @@ module Sisimai
|
|
207
207
|
end
|
208
208
|
|
209
209
|
if reasontext.empty?
|
210
|
-
# Check the value of
|
210
|
+
# Check the value of typestring
|
211
211
|
if typestring == 'X-UNIX'
|
212
212
|
# X-Unix; ...
|
213
213
|
reasontext = 'mailererror'
|
@@ -167,11 +167,10 @@ module Sisimai
|
|
167
167
|
next
|
168
168
|
end
|
169
169
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
end
|
170
|
+
next unless r.match(diagnostic)
|
171
|
+
# Match with reason defined in Sisimai::Reason::* except UserUnknown.
|
172
|
+
matchother = true
|
173
|
+
break
|
175
174
|
end
|
176
175
|
|
177
176
|
# Did not match with other message patterns
|
data/lib/sisimai/rfc3464.rb
CHANGED
@@ -19,7 +19,7 @@ module Sisimai
|
|
19
19
|
|Warning:[ ]
|
20
20
|
)
|
21
21
|
}xi,
|
22
|
-
}
|
22
|
+
}.freeze
|
23
23
|
Re1 = {
|
24
24
|
:begin => %r{\A(?>
|
25
25
|
Content-Type:[ ]*(?:
|
@@ -40,7 +40,7 @@ module Sisimai
|
|
40
40
|
}xi,
|
41
41
|
:error => %r/\A(?:[45]\d\d[ \t]+|[<][^@]+[@][^@]+[>]:?[ \t]+)/i,
|
42
42
|
:command => %r/[ ](RCPT|MAIL|DATA)[ ]+command\b/,
|
43
|
-
}
|
43
|
+
}.freeze
|
44
44
|
Indicators = Sisimai::Bite::Email.INDICATORS
|
45
45
|
|
46
46
|
def description; 'Fallback Module for MTAs'; end
|
@@ -57,7 +57,7 @@ module Sisimai
|
|
57
57
|
# @options mhead [String] others Other required headers
|
58
58
|
# @param [String] mbody Message body of a bounce email
|
59
59
|
# @return [Hash, Nil] Bounce data list and message/rfc822 part
|
60
|
-
# or
|
60
|
+
# or nil if it failed to parse or the
|
61
61
|
def scan(mhead, mbody)
|
62
62
|
return nil unless mhead
|
63
63
|
return nil unless mbody
|
@@ -95,7 +95,7 @@ module Sisimai
|
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
-
if readcursor & Indicators[:'message-rfc822']
|
98
|
+
if (readcursor & Indicators[:'message-rfc822']).zero?
|
99
99
|
# Beginning of the original message part
|
100
100
|
if e =~ Re1[:rfc822]
|
101
101
|
readcursor |= Indicators[:'message-rfc822']
|
@@ -429,19 +429,17 @@ module Sisimai
|
|
429
429
|
# Try to get a recipient address from email headers
|
430
430
|
rfc822list.each do |e|
|
431
431
|
# Check To: header in the original message
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
next if r.empty?
|
432
|
+
next unless cv = e.match(/\ATo:\s*(.+)\z/)
|
433
|
+
r = Sisimai::Address.find(cv[1], true)
|
434
|
+
next if r.empty?
|
436
435
|
|
437
|
-
|
438
|
-
|
439
|
-
end
|
440
|
-
b = dscontents[-1]
|
441
|
-
b['recipient'] = r[0][:address]
|
442
|
-
b['agent'] = Sisimai::RFC3464.smtpagent + '::Fallback'
|
443
|
-
recipients += 1
|
436
|
+
if dscontents.size == recipients
|
437
|
+
dscontents << Sisimai::Bite::Email.DELIVERYSTATUS
|
444
438
|
end
|
439
|
+
b = dscontents[-1]
|
440
|
+
b['recipient'] = r[0][:address]
|
441
|
+
b['agent'] = Sisimai::RFC3464.smtpagent + '::Fallback'
|
442
|
+
recipients += 1
|
445
443
|
end
|
446
444
|
end
|
447
445
|
|
@@ -456,7 +454,7 @@ module Sisimai
|
|
456
454
|
if e.key?('alterrors') && e['alterrors'].size > 0
|
457
455
|
# Copy alternative error message
|
458
456
|
e['diagnosis'] ||= e['alterrors']
|
459
|
-
if e['diagnosis'] =~ /\A[-]+/ || e['diagnosis']
|
457
|
+
if e['diagnosis'] =~ /\A[-]+/ || e['diagnosis'].end_with?('__')
|
460
458
|
# Override the value of diagnostic code message
|
461
459
|
e['diagnosis'] = e['alterrors'] if e['alterrors'].size > 0
|
462
460
|
end
|
data/lib/sisimai/rfc3834.rb
CHANGED
@@ -15,8 +15,8 @@ module Sisimai
|
|
15
15
|
|Out[ ]of[ ]Office:
|
16
16
|
)
|
17
17
|
/xi,
|
18
|
-
}
|
19
|
-
Re1 = { :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/ }
|
18
|
+
}.freeze
|
19
|
+
Re1 = { :endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/ }.freeze
|
20
20
|
Re2 = {
|
21
21
|
:subject => %r/(?:
|
22
22
|
SECURITY[ ]information[ ]for # sudo
|
@@ -25,7 +25,7 @@ module Sisimai
|
|
25
25
|
/x,
|
26
26
|
:from => %r/(?:root|postmaster|mailer-daemon)[@]/i,
|
27
27
|
:to => %r/root[@]/,
|
28
|
-
}
|
28
|
+
}.freeze
|
29
29
|
|
30
30
|
def description; 'Detector for auto replied message'; end
|
31
31
|
def smtpagent; 'RFC3834'; end
|
@@ -46,8 +46,8 @@ module Sisimai
|
|
46
46
|
# @options mhead [Array] received Received headers
|
47
47
|
# @options mhead [String] others Other required headers
|
48
48
|
# @param [String] mbody Message body of a bounce email
|
49
|
-
# @return [Hash,
|
50
|
-
# or
|
49
|
+
# @return [Hash, Nil] Bounce data list and message/rfc822 part
|
50
|
+
# or nil if it failed to parse or the
|
51
51
|
# arguments are missing
|
52
52
|
def scan(mhead, mbody)
|
53
53
|
return nil unless mhead
|