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/google.rb
CHANGED
@@ -7,19 +7,12 @@ module Sisimai::Lhost
|
|
7
7
|
require 'sisimai/lhost'
|
8
8
|
|
9
9
|
Indicators = Sisimai::Lhost.INDICATORS
|
10
|
+
ReBackbone = %r/^[ ]*-----[ ](?:Original[ ]message|Message[ ]header[ ]follows)[ ]-----/.freeze
|
10
11
|
StartingOf = {
|
11
12
|
message: ['Delivery to the following recipient'],
|
12
13
|
error: ['The error that the other server returned was:'],
|
13
14
|
}.freeze
|
14
|
-
MarkingsOf = {
|
15
|
-
start: %r/Technical details of (?:permanent|temporary) failure:/,
|
16
|
-
rfc822: %r{\A(?:
|
17
|
-
-----[ ]Original[ ]message[ ]-----
|
18
|
-
|[ \t]*-----[ ]Message[ ]header[ ]follows[ ]-----
|
19
|
-
)\z
|
20
|
-
}x,
|
21
|
-
}.freeze
|
22
|
-
|
15
|
+
MarkingsOf = { start: %r/Technical details of (?:permanent|temporary) failure:/ }.freeze
|
23
16
|
MessagesOf = {
|
24
17
|
'expired' => [
|
25
18
|
'DNS Error: Could not contact DNS servers',
|
@@ -172,74 +165,55 @@ module Sisimai::Lhost
|
|
172
165
|
return nil unless mhead['subject'].start_with?('Delivery Status Notification')
|
173
166
|
|
174
167
|
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
175
|
-
|
176
|
-
|
177
|
-
blanklines = 0 # (Integer) The number of blank lines
|
168
|
+
emailsteak = Sisimai::RFC5322.fillet(mbody, ReBackbone)
|
169
|
+
bodyslices = emailsteak[0].split("\n")
|
178
170
|
readcursor = 0 # (Integer) Points the current cursor position
|
179
171
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
180
172
|
statecode0 = 0 # (Integer) The value of (state *) in the error message
|
181
173
|
v = nil
|
182
174
|
|
183
|
-
while e =
|
175
|
+
while e = bodyslices.shift do
|
176
|
+
# Read error messages and delivery status lines from the head of the email
|
177
|
+
# to the previous line of the beginning of the original message.
|
184
178
|
if readcursor == 0
|
185
179
|
# Beginning of the bounce message or delivery status part
|
186
180
|
readcursor |= Indicators[:deliverystatus] if e.start_with?(StartingOf[:message][0])
|
187
181
|
end
|
182
|
+
next if (readcursor & Indicators[:deliverystatus]) == 0
|
183
|
+
next if e.empty?
|
188
184
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
185
|
+
# Technical details of permanent failure:=20
|
186
|
+
# Google tried to deliver your message, but it was rejected by the recipient =
|
187
|
+
# domain. We recommend contacting the other email provider for further inform=
|
188
|
+
# ation about the cause of this error. The error that the other server return=
|
189
|
+
# ed was: 554 554 5.7.0 Header error (state 18).
|
190
|
+
#
|
191
|
+
# -- OR --
|
192
|
+
#
|
193
|
+
# Technical details of permanent failure:=20
|
194
|
+
# Google tried to deliver your message, but it was rejected by the server for=
|
195
|
+
# the recipient domain example.jp by mx.example.jp. [192.0.2.49].
|
196
|
+
#
|
197
|
+
# The error that the other server returned was:
|
198
|
+
# 550 5.1.1 <userunknown@example.jp>... User Unknown
|
199
|
+
#
|
200
|
+
v = dscontents[-1]
|
196
201
|
|
197
|
-
if
|
198
|
-
#
|
199
|
-
if
|
200
|
-
|
201
|
-
|
202
|
-
|
202
|
+
if cv = e.match(/\A[ \t]+([^ ]+[@][^ ]+)\z/)
|
203
|
+
# kijitora@example.jp: 550 5.2.2 <kijitora@example>... Mailbox Full
|
204
|
+
if v['recipient']
|
205
|
+
# There are multiple recipient addresses in the message body.
|
206
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
207
|
+
v = dscontents[-1]
|
203
208
|
end
|
204
|
-
rfc822list << e
|
205
|
-
else
|
206
|
-
# Error message part
|
207
|
-
next if (readcursor & Indicators[:deliverystatus]) == 0
|
208
|
-
next if e.empty?
|
209
209
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
#
|
218
|
-
# Technical details of permanent failure:=20
|
219
|
-
# Google tried to deliver your message, but it was rejected by the server for=
|
220
|
-
# the recipient domain example.jp by mx.example.jp. [192.0.2.49].
|
221
|
-
#
|
222
|
-
# The error that the other server returned was:
|
223
|
-
# 550 5.1.1 <userunknown@example.jp>... User Unknown
|
224
|
-
#
|
225
|
-
v = dscontents[-1]
|
226
|
-
|
227
|
-
if cv = e.match(/\A[ \t]+([^ ]+[@][^ ]+)\z/)
|
228
|
-
# kijitora@example.jp: 550 5.2.2 <kijitora@example>... Mailbox Full
|
229
|
-
if v['recipient']
|
230
|
-
# There are multiple recipient addresses in the message body.
|
231
|
-
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
232
|
-
v = dscontents[-1]
|
233
|
-
end
|
234
|
-
|
235
|
-
r = Sisimai::Address.s3s4(cv[1])
|
236
|
-
next unless Sisimai::RFC5322.is_emailaddress(r)
|
237
|
-
v['recipient'] = r
|
238
|
-
recipients += 1
|
239
|
-
else
|
240
|
-
v['diagnosis'] ||= ''
|
241
|
-
v['diagnosis'] << e + ' '
|
242
|
-
end
|
210
|
+
r = Sisimai::Address.s3s4(cv[1])
|
211
|
+
next unless Sisimai::RFC5322.is_emailaddress(r)
|
212
|
+
v['recipient'] = r
|
213
|
+
recipients += 1
|
214
|
+
else
|
215
|
+
v['diagnosis'] ||= ''
|
216
|
+
v['diagnosis'] << e + ' '
|
243
217
|
end
|
244
218
|
end
|
245
219
|
return nil unless recipients > 0
|
@@ -286,8 +260,7 @@ module Sisimai::Lhost
|
|
286
260
|
e['reason'] = Sisimai::SMTP::Status.name(e['status']).to_s if e['status'] =~ /\A[45][.][1-7][.][1-9]\z/
|
287
261
|
end
|
288
262
|
|
289
|
-
|
290
|
-
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
263
|
+
return { 'ds' => dscontents, 'rfc822' => emailsteak[1] }
|
291
264
|
end
|
292
265
|
|
293
266
|
end
|
data/lib/sisimai/lhost/gsuite.rb
CHANGED
@@ -7,9 +7,9 @@ module Sisimai::Lhost
|
|
7
7
|
require 'sisimai/lhost'
|
8
8
|
|
9
9
|
Indicators = Sisimai::Lhost.INDICATORS
|
10
|
+
ReBackbone = %r<^Content-Type:[ ](?:message/rfc822|text/rfc822-headers)>.freeze
|
10
11
|
MarkingsOf = {
|
11
12
|
message: %r/\A[*][*][ ].+[ ][*][*]\z/,
|
12
|
-
rfc822: %r{\AContent-Type:[ ]*(?:message/rfc822|text/rfc822-headers)\z},
|
13
13
|
error: %r/\AThe[ ]response([ ]from[ ]the[ ]remote[ ]server)?[ ]was:\z/,
|
14
14
|
html: %r{\AContent-Type:[ ]*text/html;[ ]*charset=['"]?(?:UTF|utf)[-]8['"]?\z},
|
15
15
|
}.freeze
|
@@ -44,9 +44,8 @@ module Sisimai::Lhost
|
|
44
44
|
permessage = {} # (Hash) Store values of each Per-Message field
|
45
45
|
|
46
46
|
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
47
|
-
|
48
|
-
|
49
|
-
blanklines = 0 # (Integer) The number of blank lines
|
47
|
+
emailsteak = Sisimai::RFC5322.fillet(mbody, ReBackbone)
|
48
|
+
bodyslices = emailsteak[0].split("\n")
|
50
49
|
readcursor = 0 # (Integer) Points the current cursor position
|
51
50
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
52
51
|
endoferror = false # (Integer) Flag for a blank line after error messages
|
@@ -54,112 +53,94 @@ module Sisimai::Lhost
|
|
54
53
|
emptylines = 0 # (Integer) The number of empty lines
|
55
54
|
v = nil
|
56
55
|
|
57
|
-
while e =
|
56
|
+
while e = bodyslices.shift do
|
57
|
+
# Read error messages and delivery status lines from the head of the email
|
58
|
+
# to the previous line of the beginning of the original message.
|
58
59
|
if readcursor == 0
|
59
60
|
# Beginning of the bounce message or message/delivery-status part
|
60
61
|
readcursor |= Indicators[:deliverystatus] if e =~ MarkingsOf[:message]
|
61
62
|
end
|
63
|
+
next if (readcursor & Indicators[:deliverystatus]) == 0
|
62
64
|
|
63
|
-
if
|
64
|
-
#
|
65
|
-
|
66
|
-
|
67
|
-
next
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
if readcursor & Indicators[:'message-rfc822'] > 0
|
72
|
-
# message/rfc822 OR text/rfc822-headers part
|
73
|
-
if e.empty?
|
74
|
-
blanklines += 1
|
75
|
-
break if blanklines > 1
|
76
|
-
next
|
77
|
-
end
|
78
|
-
rfc822list << e
|
79
|
-
else
|
80
|
-
# message/delivery-status part
|
81
|
-
next if (readcursor & Indicators[:deliverystatus]) == 0
|
65
|
+
if f = Sisimai::RFC1894.match(e)
|
66
|
+
# "e" matched with any field defined in RFC3464
|
67
|
+
next unless o = Sisimai::RFC1894.field(e)
|
68
|
+
v = dscontents[-1]
|
82
69
|
|
83
|
-
if
|
84
|
-
#
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
if o[-1] == 'addr'
|
70
|
+
if o[-1] == 'addr'
|
71
|
+
# Final-Recipient: rfc822; kijitora@example.jp
|
72
|
+
# X-Actual-Recipient: rfc822; kijitora@example.co.jp
|
73
|
+
if o[0] == 'final-recipient'
|
89
74
|
# Final-Recipient: rfc822; kijitora@example.jp
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
# There are multiple recipient addresses in the message body.
|
95
|
-
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
96
|
-
v = dscontents[-1]
|
97
|
-
end
|
98
|
-
v['recipient'] = o[2]
|
99
|
-
recipients += 1
|
100
|
-
else
|
101
|
-
# X-Actual-Recipient: rfc822; kijitora@example.co.jp
|
102
|
-
v['alias'] = o[2]
|
75
|
+
if v['recipient']
|
76
|
+
# There are multiple recipient addresses in the message body.
|
77
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
78
|
+
v = dscontents[-1]
|
103
79
|
end
|
104
|
-
|
105
|
-
|
106
|
-
v['spec'] = o[1]
|
107
|
-
v['diagnosis'] = o[2]
|
80
|
+
v['recipient'] = o[2]
|
81
|
+
recipients += 1
|
108
82
|
else
|
109
|
-
#
|
110
|
-
|
111
|
-
v[fieldtable[o[0]]] = o[2]
|
112
|
-
|
113
|
-
next unless f == 1
|
114
|
-
permessage[fieldtable[o[0]]] = o[2]
|
83
|
+
# X-Actual-Recipient: rfc822; kijitora@example.co.jp
|
84
|
+
v['alias'] = o[2]
|
115
85
|
end
|
86
|
+
elsif o[-1] == 'code'
|
87
|
+
# Diagnostic-Code: SMTP; 550 5.1.1 <userunknown@example.jp>... User Unknown
|
88
|
+
v['spec'] = o[1]
|
89
|
+
v['diagnosis'] = o[2]
|
116
90
|
else
|
117
|
-
#
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
91
|
+
# Other DSN fields defined in RFC3464
|
92
|
+
next unless fieldtable[o[0]]
|
93
|
+
v[fieldtable[o[0]]] = o[2]
|
94
|
+
|
95
|
+
next unless f == 1
|
96
|
+
permessage[fieldtable[o[0]]] = o[2]
|
97
|
+
end
|
98
|
+
else
|
99
|
+
# The line does not begin with a DSN field defined in RFC3464
|
100
|
+
# Append error messages continued from the previous line
|
101
|
+
if endoferror == false && v && ! v['diagnosis'].to_s.empty?
|
102
|
+
endoferror ||= true if e.empty?
|
103
|
+
|
104
|
+
next if endoferror
|
105
|
+
next unless e.start_with?(' ')
|
106
|
+
v['diagnosis'] << e
|
107
|
+
|
108
|
+
elsif e =~ MarkingsOf[:error]
|
109
|
+
# Detect SMTP session error or connection error
|
110
|
+
# The response from the remote server was:
|
111
|
+
anotherset['diagnosis'] << e
|
112
|
+
else
|
113
|
+
# ** Address not found **
|
114
|
+
#
|
115
|
+
# Your message wasn't delivered to * because the address couldn't be found.
|
116
|
+
# Check for typos or unnecessary spaces and try again.
|
117
|
+
#
|
118
|
+
# The response from the remote server was:
|
119
|
+
# 550 #5.1.0 Address rejected.
|
120
|
+
next if e =~ MarkingsOf[:html]
|
121
|
+
|
122
|
+
if anotherset['diagnosis']
|
123
|
+
# Continued error messages from the previous line like
|
124
|
+
# "550 #5.1.0 Address rejected."
|
125
|
+
next if e =~ /\AContent-Type:/
|
126
|
+
next if emptylines > 5
|
127
|
+
if e.empty?
|
128
|
+
# Count and next()
|
129
|
+
emptylines += 1
|
130
|
+
next
|
131
|
+
end
|
132
|
+
anotherset['diagnosis'] << ' ' << e
|
130
133
|
else
|
131
134
|
# ** Address not found **
|
132
135
|
#
|
133
136
|
# Your message wasn't delivered to * because the address couldn't be found.
|
134
137
|
# Check for typos or unnecessary spaces and try again.
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
next if e =~ MarkingsOf[:html]
|
139
|
-
|
140
|
-
if anotherset['diagnosis']
|
141
|
-
# Continued error messages from the previous line like
|
142
|
-
# "550 #5.1.0 Address rejected."
|
143
|
-
next if e =~ /\AContent-Type:/
|
144
|
-
next if emptylines > 5
|
145
|
-
if e.empty?
|
146
|
-
# Count and next()
|
147
|
-
emptylines += 1
|
148
|
-
next
|
149
|
-
end
|
150
|
-
anotherset['diagnosis'] << ' ' << e
|
151
|
-
else
|
152
|
-
# ** Address not found **
|
153
|
-
#
|
154
|
-
# Your message wasn't delivered to * because the address couldn't be found.
|
155
|
-
# Check for typos or unnecessary spaces and try again.
|
156
|
-
next if e.empty?
|
157
|
-
next unless e =~ MarkingsOf[:message]
|
158
|
-
anotherset['diagnosis'] = e
|
159
|
-
end
|
138
|
+
next if e.empty?
|
139
|
+
next unless e =~ MarkingsOf[:message]
|
140
|
+
anotherset['diagnosis'] = e
|
160
141
|
end
|
161
142
|
end
|
162
|
-
end
|
143
|
+
end
|
163
144
|
end
|
164
145
|
return nil unless recipients > 0
|
165
146
|
|
@@ -218,8 +199,7 @@ module Sisimai::Lhost
|
|
218
199
|
end
|
219
200
|
end
|
220
201
|
|
221
|
-
|
222
|
-
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
202
|
+
return { 'ds' => dscontents, 'rfc822' => emailsteak[1] }
|
223
203
|
end
|
224
204
|
|
225
205
|
end
|
@@ -7,12 +7,8 @@ module Sisimai::Lhost
|
|
7
7
|
# Imported from p5-Sisimail/lib/Sisimai/Lhost/IMailServer.pm
|
8
8
|
require 'sisimai/lhost'
|
9
9
|
|
10
|
-
|
11
|
-
StartingOf = {
|
12
|
-
message: [''], # Blank line
|
13
|
-
rfc822: ['Original message follows.'],
|
14
|
-
error: ['Body of message generated response:'],
|
15
|
-
}.freeze
|
10
|
+
ReBackbone = %r|^Original[ ]message[ ]follows[.]|.freeze
|
11
|
+
StartingOf = { error: ['Body of message generated response:'] }.freeze
|
16
12
|
|
17
13
|
ReSMTP = {
|
18
14
|
'conn' => %r/(?:SMTP connection failed,|Unexpected connection response from server:)/,
|
@@ -52,72 +48,44 @@ module Sisimai::Lhost
|
|
52
48
|
return nil unless match > 0
|
53
49
|
|
54
50
|
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
55
|
-
|
56
|
-
|
57
|
-
blanklines = 0 # (Integer) The number of blank lines
|
58
|
-
readcursor = 0 # (Integer) Points the current cursor position
|
51
|
+
emailsteak = Sisimai::RFC5322.fillet(mbody, ReBackbone)
|
52
|
+
bodyslices = emailsteak[0].split("\n")
|
59
53
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
60
54
|
v = nil
|
61
55
|
|
62
|
-
while e =
|
63
|
-
|
64
|
-
|
65
|
-
if e == StartingOf[:message][0]
|
66
|
-
readcursor |= Indicators[:deliverystatus]
|
67
|
-
next
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
if (readcursor & Indicators[:'message-rfc822']) == 0
|
72
|
-
# Beginning of the original message part
|
73
|
-
if e == StartingOf[:rfc822][0]
|
74
|
-
readcursor |= Indicators[:'message-rfc822']
|
75
|
-
next
|
76
|
-
end
|
77
|
-
end
|
56
|
+
while e = bodyslices.shift do
|
57
|
+
# Read error messages and delivery status lines from the head of the email
|
58
|
+
# to the previous line of the beginning of the original message.
|
78
59
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
break if blanklines > 1
|
84
|
-
next
|
85
|
-
end
|
86
|
-
rfc822list << e
|
87
|
-
else
|
88
|
-
# Error message part
|
89
|
-
break if readcursor & Indicators[:'message-rfc822'] > 0
|
60
|
+
# Unknown user: kijitora@example.com
|
61
|
+
#
|
62
|
+
# Original message follows.
|
63
|
+
v = dscontents[-1]
|
90
64
|
|
65
|
+
if cv = e.match(/\A([^ ]+)[ ](.+)[:][ \t]*([^ ]+[@][^ ]+)/)
|
91
66
|
# Unknown user: kijitora@example.com
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
if cv = e.match(/\A([^ ]+)[ ](.+)[:][ \t]*([^ ]+[@][^ ]+)/)
|
97
|
-
# Unknown user: kijitora@example.com
|
98
|
-
if v['recipient']
|
99
|
-
# There are multiple recipient addresses in the message body.
|
100
|
-
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
101
|
-
v = dscontents[-1]
|
102
|
-
end
|
103
|
-
v['diagnosis'] = cv[1] + ' ' + cv[2]
|
104
|
-
v['recipient'] = cv[3]
|
105
|
-
recipients += 1
|
106
|
-
|
107
|
-
elsif cv = e.match(/\Aundeliverable[ ]+to[ ]+(.+)\z/)
|
108
|
-
# undeliverable to kijitora@example.com
|
109
|
-
if v['recipient']
|
110
|
-
# There are multiple recipient addresses in the message body.
|
111
|
-
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
112
|
-
v = dscontents[-1]
|
113
|
-
end
|
114
|
-
v['recipient'] = cv[1]
|
115
|
-
recipients += 1
|
116
|
-
else
|
117
|
-
# Other error message text
|
118
|
-
v['alterrors'] << ' ' << e if v['alterrors']
|
119
|
-
v['alterrors'] = e if e.include?(StartingOf[:error][0])
|
67
|
+
if v['recipient']
|
68
|
+
# There are multiple recipient addresses in the message body.
|
69
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
70
|
+
v = dscontents[-1]
|
120
71
|
end
|
72
|
+
v['diagnosis'] = cv[1] + ' ' + cv[2]
|
73
|
+
v['recipient'] = cv[3]
|
74
|
+
recipients += 1
|
75
|
+
|
76
|
+
elsif cv = e.match(/\Aundeliverable[ ]+to[ ]+(.+)\z/)
|
77
|
+
# undeliverable to kijitora@example.com
|
78
|
+
if v['recipient']
|
79
|
+
# There are multiple recipient addresses in the message body.
|
80
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
81
|
+
v = dscontents[-1]
|
82
|
+
end
|
83
|
+
v['recipient'] = cv[1]
|
84
|
+
recipients += 1
|
85
|
+
else
|
86
|
+
# Other error message text
|
87
|
+
v['alterrors'] << ' ' << e if v['alterrors']
|
88
|
+
v['alterrors'] = e if e.include?(StartingOf[:error][0])
|
121
89
|
end
|
122
90
|
end
|
123
91
|
return nil unless recipients > 0
|
@@ -153,8 +121,7 @@ module Sisimai::Lhost
|
|
153
121
|
e.each_key { |a| e[a] ||= '' }
|
154
122
|
end
|
155
123
|
|
156
|
-
|
157
|
-
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
124
|
+
return { 'ds' => dscontents, 'rfc822' => emailsteak[1] }
|
158
125
|
end
|
159
126
|
|
160
127
|
end
|