sisimai 4.25.4-java → 4.25.5-java
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 +5 -5
- data/.travis.yml +2 -2
- data/ChangeLog.md +50 -0
- data/README-JA.md +10 -37
- data/README.md +10 -37
- data/lib/sisimai.rb +15 -64
- data/lib/sisimai/address.rb +13 -17
- data/lib/sisimai/arf.rb +4 -4
- data/lib/sisimai/data.rb +3 -5
- data/lib/sisimai/lhost.rb +0 -14
- data/lib/sisimai/lhost/activehunter.rb +31 -55
- data/lib/sisimai/lhost/amavis.rb +41 -66
- data/lib/sisimai/lhost/amazonses.rb +189 -235
- data/lib/sisimai/lhost/amazonworkmail.rb +48 -71
- data/lib/sisimai/lhost/aol.rb +49 -75
- data/lib/sisimai/lhost/apachejames.rb +60 -83
- data/lib/sisimai/lhost/bigfoot.rb +61 -85
- data/lib/sisimai/lhost/biglobe.rb +40 -62
- data/lib/sisimai/lhost/courier.rb +60 -82
- data/lib/sisimai/lhost/domino.rb +50 -76
- data/lib/sisimai/lhost/einsundeins.rb +57 -55
- data/lib/sisimai/lhost/exchange2003.rb +79 -101
- data/lib/sisimai/lhost/exchange2007.rb +66 -74
- data/lib/sisimai/lhost/exim.rb +119 -142
- data/lib/sisimai/lhost/ezweb.rb +53 -73
- data/lib/sisimai/lhost/facebook.rb +49 -75
- data/lib/sisimai/lhost/fml.rb +25 -50
- data/lib/sisimai/lhost/gmx.rb +55 -79
- data/lib/sisimai/lhost/google.rb +39 -66
- data/lib/sisimai/lhost/gsuite.rb +74 -94
- data/lib/sisimai/lhost/imailserver.rb +34 -67
- data/lib/sisimai/lhost/interscanmss.rb +33 -67
- data/lib/sisimai/lhost/kddi.rb +30 -52
- data/lib/sisimai/lhost/mailfoundry.rb +35 -57
- data/lib/sisimai/lhost/mailmarshalsmtp.rb +66 -89
- data/lib/sisimai/lhost/mailru.rb +51 -76
- data/lib/sisimai/lhost/mcafee.rb +53 -79
- data/lib/sisimai/lhost/messagelabs.rb +49 -75
- data/lib/sisimai/lhost/messagingserver.rb +91 -113
- data/lib/sisimai/lhost/mfilter.rb +50 -70
- data/lib/sisimai/lhost/mxlogic.rb +38 -63
- data/lib/sisimai/lhost/notes.rb +53 -82
- data/lib/sisimai/lhost/office365.rb +64 -81
- data/lib/sisimai/lhost/opensmtpd.rb +30 -52
- data/lib/sisimai/lhost/outlook.rb +49 -75
- data/lib/sisimai/lhost/postfix.rb +116 -117
- data/lib/sisimai/lhost/qmail.rb +33 -55
- data/lib/sisimai/lhost/receivingses.rb +49 -75
- data/lib/sisimai/lhost/sendgrid.rb +68 -203
- data/lib/sisimai/lhost/sendmail.rb +101 -125
- data/lib/sisimai/lhost/surfcontrol.rb +53 -79
- data/lib/sisimai/lhost/userdefined.rb +15 -35
- data/lib/sisimai/lhost/v5sendmail.rb +59 -89
- data/lib/sisimai/lhost/verizon.rb +75 -124
- data/lib/sisimai/lhost/x1.rb +30 -54
- data/lib/sisimai/lhost/x2.rb +28 -52
- data/lib/sisimai/lhost/x3.rb +44 -68
- data/lib/sisimai/lhost/x4.rb +34 -58
- data/lib/sisimai/lhost/x5.rb +42 -70
- data/lib/sisimai/lhost/yahoo.rb +44 -68
- data/lib/sisimai/lhost/yandex.rb +59 -85
- data/lib/sisimai/lhost/zoho.rb +54 -78
- data/lib/sisimai/mail.rb +5 -9
- data/lib/sisimai/mail/maildir.rb +10 -14
- data/lib/sisimai/mail/mbox.rb +8 -12
- data/lib/sisimai/mail/memory.rb +5 -9
- data/lib/sisimai/mail/stdin.rb +7 -11
- data/lib/sisimai/mda.rb +2 -2
- data/lib/sisimai/message.rb +51 -154
- data/lib/sisimai/mime.rb +2 -2
- data/lib/sisimai/order.rb +2 -27
- data/lib/sisimai/reason.rb +3 -5
- data/lib/sisimai/rfc1894.rb +1 -1
- data/lib/sisimai/rfc3464.rb +29 -29
- data/lib/sisimai/rfc3834.rb +7 -6
- data/lib/sisimai/rfc5322.rb +20 -31
- data/lib/sisimai/rhost/franceptt.rb +120 -24
- data/lib/sisimai/rhost/iua.rb +1 -1
- data/lib/sisimai/smtp/error.rb +7 -7
- data/lib/sisimai/version.rb +1 -1
- data/set-of-emails/maildir/bsd/email-einsundeins-03.eml +66 -0
- data/set-of-emails/maildir/bsd/email-exchange2007-05.eml +1469 -0
- data/set-of-emails/maildir/bsd/email-exchange2007-06.eml +764 -0
- data/set-of-emails/maildir/bsd/email-postfix-64.eml +96 -0
- data/set-of-emails/maildir/bsd/rfc3834-03.eml +26 -0
- data/set-of-emails/maildir/bsd/rhost-franceptt-04.eml +66 -0
- data/set-of-emails/maildir/bsd/rhost-franceptt-05.eml +96 -0
- data/set-of-emails/maildir/bsd/rhost-franceptt-06.eml +100 -0
- data/set-of-emails/maildir/bsd/rhost-franceptt-07.eml +97 -0
- data/set-of-emails/maildir/bsd/rhost-franceptt-08.eml +78 -0
- data/set-of-emails/maildir/bsd/rhost-franceptt-10.eml +79 -0
- data/set-of-emails/maildir/bsd/rhost-franceptt-11.eml +96 -0
- metadata +27 -21
- data/lib/sisimai/bite.rb +0 -42
- data/lib/sisimai/bite/email.rb +0 -18
- data/lib/sisimai/bite/json.rb +0 -16
- data/lib/sisimai/message/email.rb +0 -26
- data/lib/sisimai/message/json.rb +0 -24
- data/lib/sisimai/order/email.rb +0 -20
- data/lib/sisimai/order/json.rb +0 -16
data/lib/sisimai/lhost/mailru.rb
CHANGED
@@ -8,11 +8,8 @@ module Sisimai::Lhost
|
|
8
8
|
require 'sisimai/lhost'
|
9
9
|
|
10
10
|
Indicators = Sisimai::Lhost.INDICATORS
|
11
|
-
|
12
|
-
|
13
|
-
rfc822: ['------ This is a copy of the message, including all the headers. ------'],
|
14
|
-
}.freeze
|
15
|
-
|
11
|
+
ReBackbone = %r|^------ This is a copy of the message, including all the headers[.] ------|.freeze
|
12
|
+
StartingOf = { message: ['This message was created automatically by mail delivery software.'] }.freeze
|
16
13
|
ReCommands = [
|
17
14
|
%r/SMTP error from remote (?:mail server|mailer) after ([A-Za-z]{4})/,
|
18
15
|
%r/SMTP error from remote (?:mail server|mailer) after end of ([A-Za-z]{4})/,
|
@@ -77,86 +74,65 @@ module Sisimai::Lhost
|
|
77
74
|
}x
|
78
75
|
|
79
76
|
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
80
|
-
|
81
|
-
|
82
|
-
blanklines = 0 # (Integer) The number of blank lines
|
77
|
+
emailsteak = Sisimai::RFC5322.fillet(mbody, ReBackbone)
|
78
|
+
bodyslices = emailsteak[0].split("\n")
|
83
79
|
readcursor = 0 # (Integer) Points the current cursor position
|
84
80
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
85
81
|
localhost0 = '' # (String) Local MTA
|
86
82
|
v = nil
|
87
83
|
|
88
|
-
while e =
|
84
|
+
while e = bodyslices.shift do
|
85
|
+
# Read error messages and delivery status lines from the head of the email
|
86
|
+
# to the previous line of the beginning of the original message.
|
89
87
|
if readcursor == 0
|
90
88
|
# Beginning of the bounce message or delivery status part
|
91
|
-
if e.start_with?(StartingOf[:message][0])
|
92
|
-
|
93
|
-
next
|
94
|
-
end
|
89
|
+
readcursor |= Indicators[:deliverystatus] if e.start_with?(StartingOf[:message][0])
|
90
|
+
next
|
95
91
|
end
|
96
|
-
|
97
|
-
if
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
92
|
+
next if (readcursor & Indicators[:deliverystatus]) == 0
|
93
|
+
next if e.empty?
|
94
|
+
|
95
|
+
# Это письмо создано автоматически
|
96
|
+
# сервером Mail.Ru, # отвечать на него не
|
97
|
+
# нужно.
|
98
|
+
#
|
99
|
+
# К сожалению, Ваше письмо не может
|
100
|
+
# быть# доставлено одному или нескольким
|
101
|
+
# получателям:
|
102
|
+
#
|
103
|
+
# **********************
|
104
|
+
#
|
105
|
+
# This message was created automatically by mail delivery software.
|
106
|
+
#
|
107
|
+
# A message that you sent could not be delivered to one or more of its
|
108
|
+
# recipients. This is a permanent error. The following address(es) failed:
|
109
|
+
#
|
110
|
+
# kijitora@example.jp
|
111
|
+
# SMTP error from remote mail server after RCPT TO:<kijitora@example.jp>:
|
112
|
+
# host neko.example.jp [192.0.2.222]: 550 5.1.1 <kijitora@example.jp>... User Unknown
|
113
|
+
v = dscontents[-1]
|
114
|
+
|
115
|
+
if cv = e.match(/\A[ \t]+([^ \t]+[@][^ \t]+[.][a-zA-Z]+)\z/)
|
116
|
+
# kijitora@example.jp
|
117
|
+
if v['recipient']
|
118
|
+
# There are multiple recipient addresses in the message body.
|
119
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
120
|
+
v = dscontents[-1]
|
102
121
|
end
|
103
|
-
|
122
|
+
v['recipient'] = cv[1]
|
123
|
+
recipients += 1
|
104
124
|
|
105
|
-
|
106
|
-
#
|
107
|
-
if e.empty?
|
108
|
-
blanklines += 1
|
109
|
-
break if blanklines > 1
|
110
|
-
next
|
111
|
-
end
|
112
|
-
rfc822list << e
|
113
|
-
else
|
114
|
-
# Error message part
|
115
|
-
next if (readcursor & Indicators[:deliverystatus]) == 0
|
125
|
+
elsif dscontents.size == recipients
|
126
|
+
# Error message
|
116
127
|
next if e.empty?
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
#
|
121
|
-
#
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
#
|
126
|
-
# **********************
|
127
|
-
#
|
128
|
-
# This message was created automatically by mail delivery software.
|
129
|
-
#
|
130
|
-
# A message that you sent could not be delivered to one or more of its
|
131
|
-
# recipients. This is a permanent error. The following address(es) failed:
|
132
|
-
#
|
133
|
-
# kijitora@example.jp
|
134
|
-
# SMTP error from remote mail server after RCPT TO:<kijitora@example.jp>:
|
135
|
-
# host neko.example.jp [192.0.2.222]: 550 5.1.1 <kijitora@example.jp>... User Unknown
|
136
|
-
v = dscontents[-1]
|
137
|
-
|
138
|
-
if cv = e.match(/\A[ \t]+([^ \t]+[@][^ \t]+[.][a-zA-Z]+)\z/)
|
139
|
-
# kijitora@example.jp
|
140
|
-
if v['recipient']
|
141
|
-
# There are multiple recipient addresses in the message body.
|
142
|
-
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
143
|
-
v = dscontents[-1]
|
144
|
-
end
|
145
|
-
v['recipient'] = cv[1]
|
146
|
-
recipients += 1
|
147
|
-
|
148
|
-
elsif dscontents.size == recipients
|
149
|
-
# Error message
|
150
|
-
next if e.empty?
|
151
|
-
v['diagnosis'] ||= ''
|
152
|
-
v['diagnosis'] << e + ' '
|
153
|
-
else
|
154
|
-
# Error message when email address above does not include '@'
|
155
|
-
# and domain part.
|
156
|
-
next unless e.start_with?(' ', "\t")
|
157
|
-
v['alterrors'] ||= ''
|
158
|
-
v['alterrors'] << e + ' '
|
159
|
-
end
|
128
|
+
v['diagnosis'] ||= ''
|
129
|
+
v['diagnosis'] << e + ' '
|
130
|
+
else
|
131
|
+
# Error message when email address above does not include '@'
|
132
|
+
# and domain part.
|
133
|
+
next unless e.start_with?(' ', "\t")
|
134
|
+
v['alterrors'] ||= ''
|
135
|
+
v['alterrors'] << e + ' '
|
160
136
|
end
|
161
137
|
end
|
162
138
|
|
@@ -243,8 +219,7 @@ module Sisimai::Lhost
|
|
243
219
|
e['agent'] = self.smtpagent
|
244
220
|
end
|
245
221
|
|
246
|
-
|
247
|
-
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
222
|
+
return { 'ds' => dscontents, 'rfc822' => emailsteak[1] }
|
248
223
|
end
|
249
224
|
|
250
225
|
end
|
data/lib/sisimai/lhost/mcafee.rb
CHANGED
@@ -7,10 +7,8 @@ module Sisimai::Lhost
|
|
7
7
|
require 'sisimai/lhost'
|
8
8
|
|
9
9
|
Indicators = Sisimai::Lhost.INDICATORS
|
10
|
-
|
11
|
-
|
12
|
-
rfc822: ['Content-Type: message/rfc822'],
|
13
|
-
}.freeze
|
10
|
+
ReBackbone = %r|^Content-Type:[ ]message/rfc822|.freeze
|
11
|
+
StartingOf = { message: ['--- The following addresses had delivery problems ---'] }.freeze
|
14
12
|
ReFailures = {
|
15
13
|
'userunknown' => %r{(?:
|
16
14
|
[ ]User[ ][(].+[@].+[)][ ]unknown[.][ ]
|
@@ -44,92 +42,69 @@ module Sisimai::Lhost
|
|
44
42
|
require 'sisimai/rfc1894'
|
45
43
|
fieldtable = Sisimai::RFC1894.FIELDTABLE
|
46
44
|
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
blanklines = 0 # (Integer) The number of blank lines
|
45
|
+
emailsteak = Sisimai::RFC5322.fillet(mbody, ReBackbone)
|
46
|
+
bodyslices = emailsteak[0].split("\n")
|
47
|
+
readslices = ['']
|
51
48
|
readcursor = 0 # (Integer) Points the current cursor position
|
52
49
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
53
50
|
diagnostic = '' # (String) Alternative diagnostic message
|
54
51
|
v = nil
|
55
52
|
|
56
|
-
while e =
|
57
|
-
#
|
58
|
-
|
59
|
-
|
53
|
+
while e = bodyslices.shift do
|
54
|
+
# Read error messages and delivery status lines from the head of the email
|
55
|
+
# to the previous line of the beginning of the original message.
|
56
|
+
readslices << e # Save the current line for the next loop
|
60
57
|
|
61
58
|
if readcursor == 0
|
62
59
|
# Beginning of the bounce message or delivery status part
|
63
|
-
if e.include?(StartingOf[:message][0])
|
64
|
-
|
65
|
-
next
|
66
|
-
end
|
60
|
+
readcursor |= Indicators[:deliverystatus] if e.include?(StartingOf[:message][0])
|
61
|
+
next
|
67
62
|
end
|
68
|
-
|
69
|
-
if
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
63
|
+
next if (readcursor & Indicators[:deliverystatus]) == 0
|
64
|
+
next if e.empty?
|
65
|
+
|
66
|
+
# Content-Type: text/plain; name="deliveryproblems.txt"
|
67
|
+
#
|
68
|
+
# --- The following addresses had delivery problems ---
|
69
|
+
#
|
70
|
+
# <user@example.com> (User unknown user@example.com)
|
71
|
+
#
|
72
|
+
# --------------Boundary-00=_00000000000000000000
|
73
|
+
# Content-Type: message/delivery-status; name="deliverystatus.txt"
|
74
|
+
#
|
75
|
+
v = dscontents[-1]
|
76
|
+
|
77
|
+
if cv = e.match(/\A[<]([^ ]+[@][^ ]+)[>][ \t]+[(](.+)[)]\z/)
|
78
|
+
# <kijitora@example.co.jp> (Unknown user kijitora@example.co.jp)
|
79
|
+
if v['recipient']
|
80
|
+
# There are multiple recipient addresses in the message body.
|
81
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
82
|
+
v = dscontents[-1]
|
74
83
|
end
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
84
|
+
v['recipient'] = cv[1]
|
85
|
+
diagnostic = cv[2]
|
86
|
+
recipients += 1
|
87
|
+
|
88
|
+
elsif f = Sisimai::RFC1894.match(e)
|
89
|
+
# "e" matched with any field defined in RFC3464
|
90
|
+
o = Sisimai::RFC1894.field(e)
|
91
|
+
unless o
|
92
|
+
# Fallback code for empty value or invalid formatted value
|
93
|
+
# - Original-Recipient: <kijitora@example.co.jp>
|
94
|
+
if cv = e.match(/\AOriginal-Recipient:[ ]*([^ ]+)\z/)
|
95
|
+
v['alias'] = Sisimai::Address.s3s4(cv[1])
|
96
|
+
end
|
82
97
|
next
|
83
98
|
end
|
84
|
-
|
85
|
-
|
86
|
-
# Error message part
|
87
|
-
next if (readcursor & Indicators[:deliverystatus]) == 0
|
88
|
-
next if e.empty?
|
89
|
-
|
90
|
-
# Content-Type: text/plain; name="deliveryproblems.txt"
|
91
|
-
#
|
92
|
-
# --- The following addresses had delivery problems ---
|
93
|
-
#
|
94
|
-
# <user@example.com> (User unknown user@example.com)
|
95
|
-
#
|
96
|
-
# --------------Boundary-00=_00000000000000000000
|
97
|
-
# Content-Type: message/delivery-status; name="deliverystatus.txt"
|
98
|
-
#
|
99
|
-
v = dscontents[-1]
|
100
|
-
|
101
|
-
if cv = e.match(/\A[<]([^ ]+[@][^ ]+)[>][ \t]+[(](.+)[)]\z/)
|
102
|
-
# <kijitora@example.co.jp> (Unknown user kijitora@example.co.jp)
|
103
|
-
if v['recipient']
|
104
|
-
# There are multiple recipient addresses in the message body.
|
105
|
-
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
106
|
-
v = dscontents[-1]
|
107
|
-
end
|
108
|
-
v['recipient'] = cv[1]
|
109
|
-
diagnostic = cv[2]
|
110
|
-
recipients += 1
|
99
|
+
next unless fieldtable[o[0]]
|
100
|
+
v[fieldtable[o[0]]] = o[2]
|
111
101
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
if cv = e.match(/\AOriginal-Recipient:[ ]*([^ ]+)\z/)
|
119
|
-
v['alias'] = Sisimai::Address.s3s4(cv[1])
|
120
|
-
end
|
121
|
-
next
|
122
|
-
end
|
123
|
-
next unless fieldtable.key?(o[0])
|
124
|
-
v[fieldtable[o[0]]] = o[2]
|
125
|
-
|
126
|
-
else
|
127
|
-
# Continued line of the value of Diagnostic-Code field
|
128
|
-
next unless p.start_with?('Diagnostic-Code:')
|
129
|
-
next unless cv = e.match(/\A[ \t]+(.+)\z/)
|
130
|
-
v['diagnosis'] << ' ' << cv[1]
|
131
|
-
havepassed[-1] = 'Diagnostic-Code: ' << e
|
132
|
-
end
|
102
|
+
else
|
103
|
+
# Continued line of the value of Diagnostic-Code field
|
104
|
+
next unless readslices[-2].start_with?('Diagnostic-Code:')
|
105
|
+
next unless cv = e.match(/\A[ \t]+(.+)\z/)
|
106
|
+
v['diagnosis'] << ' ' << cv[1]
|
107
|
+
readslices[-1] = 'Diagnostic-Code: ' << e
|
133
108
|
end
|
134
109
|
end
|
135
110
|
return nil unless recipients > 0
|
@@ -147,8 +122,7 @@ module Sisimai::Lhost
|
|
147
122
|
e.each_key { |a| e[a] ||= '' }
|
148
123
|
end
|
149
124
|
|
150
|
-
|
151
|
-
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
125
|
+
return { 'ds' => dscontents, 'rfc822' => emailsteak[1] }
|
152
126
|
end
|
153
127
|
|
154
128
|
end
|
@@ -8,10 +8,8 @@ module Sisimai::Lhost
|
|
8
8
|
require 'sisimai/lhost'
|
9
9
|
|
10
10
|
Indicators = Sisimai::Lhost.INDICATORS
|
11
|
-
|
12
|
-
|
13
|
-
rfc822: ['Content-Type: text/rfc822-headers'],
|
14
|
-
}.freeze
|
11
|
+
ReBackbone = %r|^Content-Type:[ ]text/rfc822-headers|.freeze
|
12
|
+
StartingOf = { message: ['Content-Type: message/delivery-status'] }.freeze
|
15
13
|
ReFailures = {
|
16
14
|
'userunknown' => %r/(?:542 .+ Rejected|No such user)/,
|
17
15
|
'securityerror' => %r/Please turn on SMTP Authentication in your mail client/,
|
@@ -48,90 +46,67 @@ module Sisimai::Lhost
|
|
48
46
|
permessage = {} # (Hash) Store values of each Per-Message field
|
49
47
|
|
50
48
|
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
blanklines = 0 # (Integer) The number of blank lines
|
49
|
+
emailsteak = Sisimai::RFC5322.fillet(mbody, ReBackbone)
|
50
|
+
bodyslices = emailsteak[0].split("\n")
|
51
|
+
readslices = ['']
|
55
52
|
readcursor = 0 # (Integer) Points the current cursor position
|
56
53
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
57
54
|
commandset = [] # (Array) ``in reply to * command'' list
|
58
55
|
v = nil
|
59
56
|
|
60
|
-
while e =
|
61
|
-
#
|
62
|
-
|
63
|
-
|
57
|
+
while e = bodyslices.shift do
|
58
|
+
# Read error messages and delivery status lines from the head of the email
|
59
|
+
# to the previous line of the beginning of the original message.
|
60
|
+
readslices << e # Save the current line for the next loop
|
64
61
|
|
65
62
|
if readcursor == 0
|
66
63
|
# Beginning of the bounce message or message/delivery-status part
|
67
|
-
if e.start_with?(StartingOf[:message][0])
|
68
|
-
|
69
|
-
next
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
if (readcursor & Indicators[:'message-rfc822']) == 0
|
74
|
-
# Beginning of the original message part(message/rfc822)
|
75
|
-
if e == StartingOf[:rfc822][0]
|
76
|
-
readcursor |= Indicators[:'message-rfc822']
|
77
|
-
next
|
78
|
-
end
|
64
|
+
readcursor |= Indicators[:deliverystatus] if e.start_with?(StartingOf[:message][0])
|
65
|
+
next
|
79
66
|
end
|
80
|
-
|
81
|
-
if
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
next if e.empty?
|
93
|
-
|
94
|
-
if f = Sisimai::RFC1894.match(e)
|
95
|
-
# "e" matched with any field defined in RFC3464
|
96
|
-
next unless o = Sisimai::RFC1894.field(e)
|
97
|
-
v = dscontents[-1]
|
98
|
-
|
99
|
-
if o[-1] == 'addr'
|
67
|
+
next if (readcursor & Indicators[:deliverystatus]) == 0
|
68
|
+
next if e.empty?
|
69
|
+
|
70
|
+
if f = Sisimai::RFC1894.match(e)
|
71
|
+
# "e" matched with any field defined in RFC3464
|
72
|
+
next unless o = Sisimai::RFC1894.field(e)
|
73
|
+
v = dscontents[-1]
|
74
|
+
|
75
|
+
if o[-1] == 'addr'
|
76
|
+
# Final-Recipient: rfc822; kijitora@example.jp
|
77
|
+
# X-Actual-Recipient: rfc822; kijitora@example.co.jp
|
78
|
+
if o[0] == 'final-recipient'
|
100
79
|
# Final-Recipient: rfc822; kijitora@example.jp
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
# There are multiple recipient addresses in the message body.
|
106
|
-
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
107
|
-
v = dscontents[-1]
|
108
|
-
end
|
109
|
-
v['recipient'] = o[2]
|
110
|
-
recipients += 1
|
111
|
-
else
|
112
|
-
# X-Actual-Recipient: rfc822; kijitora@example.co.jp
|
113
|
-
v['alias'] = o[2]
|
80
|
+
if v['recipient']
|
81
|
+
# There are multiple recipient addresses in the message body.
|
82
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
83
|
+
v = dscontents[-1]
|
114
84
|
end
|
115
|
-
|
116
|
-
|
117
|
-
v['spec'] = o[1]
|
118
|
-
v['diagnosis'] = o[2]
|
85
|
+
v['recipient'] = o[2]
|
86
|
+
recipients += 1
|
119
87
|
else
|
120
|
-
#
|
121
|
-
|
122
|
-
v[fieldtable[o[0]]] = o[2]
|
123
|
-
|
124
|
-
next unless f == 1
|
125
|
-
permessage[fieldtable[o[0]]] = o[2]
|
88
|
+
# X-Actual-Recipient: rfc822; kijitora@example.co.jp
|
89
|
+
v['alias'] = o[2]
|
126
90
|
end
|
91
|
+
elsif o[-1] == 'code'
|
92
|
+
# Diagnostic-Code: SMTP; 550 5.1.1 <userunknown@example.jp>... User Unknown
|
93
|
+
v['spec'] = o[1]
|
94
|
+
v['diagnosis'] = o[2]
|
127
95
|
else
|
128
|
-
#
|
129
|
-
next unless
|
130
|
-
|
131
|
-
|
132
|
-
|
96
|
+
# Other DSN fields defined in RFC3464
|
97
|
+
next unless fieldtable[o[0]]
|
98
|
+
v[fieldtable[o[0]]] = o[2]
|
99
|
+
|
100
|
+
next unless f == 1
|
101
|
+
permessage[fieldtable[o[0]]] = o[2]
|
133
102
|
end
|
134
|
-
|
103
|
+
else
|
104
|
+
# Continued line of the value of Diagnostic-Code field
|
105
|
+
next unless readslices[-2].start_with?('Diagnostic-Code:')
|
106
|
+
next unless cv = e.match(/\A[ \t]+(.+)\z/)
|
107
|
+
v['diagnosis'] << ' ' << cv[1]
|
108
|
+
readslices[-1] = 'Diagnostic-Code: ' << e
|
109
|
+
end
|
135
110
|
end
|
136
111
|
return nil unless recipients > 0
|
137
112
|
|
@@ -151,8 +126,7 @@ module Sisimai::Lhost
|
|
151
126
|
end
|
152
127
|
end
|
153
128
|
|
154
|
-
|
155
|
-
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
129
|
+
return { 'ds' => dscontents, 'rfc822' => emailsteak[1] }
|
156
130
|
end
|
157
131
|
|
158
132
|
end
|