sisimai 4.16.0-java → 4.17.0-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 +4 -4
- data/.rubocop.yml +3 -0
- data/ANALYTICAL-PRECISION +7 -7
- data/Changes +15 -0
- data/Makefile +1 -1
- data/README.md +30 -28
- data/lib/sisimai.rb +20 -1
- data/lib/sisimai/address.rb +28 -9
- data/lib/sisimai/arf.rb +37 -46
- data/lib/sisimai/data.rb +67 -43
- data/lib/sisimai/datetime.rb +210 -210
- data/lib/sisimai/mda.rb +30 -30
- data/lib/sisimai/message.rb +3 -5
- data/lib/sisimai/msp/de/einsundeins.rb +14 -42
- data/lib/sisimai/msp/de/gmx.rb +17 -44
- data/lib/sisimai/msp/jp/biglobe.rb +15 -44
- data/lib/sisimai/msp/jp/ezweb.rb +20 -50
- data/lib/sisimai/msp/jp/kddi.rb +16 -43
- data/lib/sisimai/msp/ru/mailru.rb +20 -48
- data/lib/sisimai/msp/ru/yandex.rb +16 -50
- data/lib/sisimai/msp/uk/messagelabs.rb +17 -51
- data/lib/sisimai/msp/us/amazonses.rb +18 -40
- data/lib/sisimai/msp/us/amazonworkmail.rb +17 -35
- data/lib/sisimai/msp/us/aol.rb +17 -41
- data/lib/sisimai/msp/us/bigfoot.rb +15 -48
- data/lib/sisimai/msp/us/facebook.rb +63 -90
- data/lib/sisimai/msp/us/google.rb +15 -44
- data/lib/sisimai/msp/us/office365.rb +21 -46
- data/lib/sisimai/msp/us/outlook.rb +17 -50
- data/lib/sisimai/msp/us/receivingses.rb +20 -43
- data/lib/sisimai/msp/us/sendgrid.rb +13 -37
- data/lib/sisimai/msp/us/verizon.rb +30 -74
- data/lib/sisimai/msp/us/yahoo.rb +12 -40
- data/lib/sisimai/msp/us/zoho.rb +14 -42
- data/lib/sisimai/mta/activehunter.rb +11 -40
- data/lib/sisimai/mta/apachejames.rb +18 -40
- data/lib/sisimai/mta/courier.rb +20 -57
- data/lib/sisimai/mta/domino.rb +24 -56
- data/lib/sisimai/mta/exchange.rb +26 -54
- data/lib/sisimai/mta/exim.rb +20 -39
- data/lib/sisimai/mta/imailserver.rb +26 -71
- data/lib/sisimai/mta/interscanmss.rb +26 -44
- data/lib/sisimai/mta/mailfoundry.rb +12 -42
- data/lib/sisimai/mta/mailmarshalsmtp.rb +13 -43
- data/lib/sisimai/mta/mcafee.rb +17 -46
- data/lib/sisimai/mta/messagingserver.rb +14 -47
- data/lib/sisimai/mta/mfilter.rb +12 -35
- data/lib/sisimai/mta/mxlogic.rb +18 -42
- data/lib/sisimai/mta/notes.rb +22 -45
- data/lib/sisimai/mta/opensmtpd.rb +18 -48
- data/lib/sisimai/mta/postfix.rb +15 -45
- data/lib/sisimai/mta/qmail.rb +32 -60
- data/lib/sisimai/mta/sendmail.rb +13 -38
- data/lib/sisimai/mta/surfcontrol.rb +15 -44
- data/lib/sisimai/mta/userdefined.rb +14 -30
- data/lib/sisimai/mta/v5sendmail.rb +18 -40
- data/lib/sisimai/mta/x1.rb +12 -41
- data/lib/sisimai/mta/x2.rb +12 -41
- data/lib/sisimai/mta/x3.rb +12 -39
- data/lib/sisimai/mta/x4.rb +33 -66
- data/lib/sisimai/mta/x5.rb +15 -42
- data/lib/sisimai/reason.rb +8 -71
- data/lib/sisimai/reason/blocked.rb +3 -0
- data/lib/sisimai/reason/contenterror.rb +3 -0
- data/lib/sisimai/reason/delivered.rb +27 -0
- data/lib/sisimai/reason/exceedlimit.rb +3 -0
- data/lib/sisimai/reason/expired.rb +3 -0
- data/lib/sisimai/reason/feedback.rb +18 -0
- data/lib/sisimai/reason/filtered.rb +4 -0
- data/lib/sisimai/reason/hasmoved.rb +3 -0
- data/lib/sisimai/reason/hostunknown.rb +3 -0
- data/lib/sisimai/reason/mailboxfull.rb +3 -0
- data/lib/sisimai/reason/mailererror.rb +3 -0
- data/lib/sisimai/reason/mesgtoobig.rb +3 -0
- data/lib/sisimai/reason/networkerror.rb +3 -0
- data/lib/sisimai/reason/norelaying.rb +3 -0
- data/lib/sisimai/reason/notaccept.rb +3 -0
- data/lib/sisimai/reason/onhold.rb +3 -0
- data/lib/sisimai/reason/rejected.rb +3 -0
- data/lib/sisimai/reason/securityerror.rb +3 -0
- data/lib/sisimai/reason/spamdetected.rb +3 -0
- data/lib/sisimai/reason/suspend.rb +3 -0
- data/lib/sisimai/reason/syntaxerror.rb +41 -0
- data/lib/sisimai/reason/systemerror.rb +3 -0
- data/lib/sisimai/reason/systemfull.rb +3 -0
- data/lib/sisimai/reason/toomanyconn.rb +3 -0
- data/lib/sisimai/reason/undefined.rb +18 -0
- data/lib/sisimai/reason/userunknown.rb +3 -0
- data/lib/sisimai/reason/vacation.rb +18 -0
- data/lib/sisimai/rfc3464.rb +15 -40
- data/lib/sisimai/rfc3834.rb +1 -10
- data/lib/sisimai/rfc5322.rb +57 -19
- data/lib/sisimai/rhost/googleapps.rb +82 -82
- data/lib/sisimai/smtp/reply.rb +2 -1
- data/lib/sisimai/smtp/status.rb +154 -152
- data/lib/sisimai/string.rb +2 -3
- data/lib/sisimai/version.rb +1 -1
- data/set-of-emails/maildir/bsd/rfc3464-29.eml +60 -0
- data/set-of-emails/maildir/bsd/us-amazonworkmail-06.eml +156 -0
- data/set-of-emails/maildir/bsd/us-amazonworkmail-07.eml +158 -0
- data/set-of-emails/maildir/bsd/us-google-15.eml +97 -0
- data/set-of-emails/maildir/bsd/us-google-16.eml +99 -0
- data/set-of-emails/maildir/bsd/us-google-17.eml +104 -0
- data/set-of-emails/maildir/dos/apachejames-01.eml +4 -4
- data/set-of-emails/maildir/dos/us-amazonworkmail-01.eml +156 -0
- data/set-of-emails/maildir/dos/us-office365-01.eml +102 -0
- data/set-of-emails/maildir/mac/apachejames-01.eml +1 -9
- data/set-of-emails/maildir/mac/us-amazonworkmail-01.eml +1 -7
- data/set-of-emails/maildir/mac/us-office365-01.eml +1 -4
- metadata +17 -2
@@ -20,11 +20,9 @@ module Sisimai
|
|
20
20
|
:endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
|
21
21
|
}
|
22
22
|
ReFailure = {
|
23
|
-
|
23
|
+
userunknown: %r/No[ ]such[ ]user/x,
|
24
24
|
}
|
25
25
|
Indicators = Sisimai::MSP.INDICATORS
|
26
|
-
LongFields = Sisimai::RFC5322.LONGFIELDS
|
27
|
-
RFC822Head = Sisimai::RFC5322.HEADERFIELDS
|
28
26
|
|
29
27
|
def description; return 'Symantec.cloud http://www.messagelabs.com'; end
|
30
28
|
def smtpagent; return 'UK::MessageLabs'; end
|
@@ -55,12 +53,11 @@ module Sisimai
|
|
55
53
|
return nil unless mhead['from'] =~ Re0[:from]
|
56
54
|
return nil unless mhead['subject'] =~ Re0[:subject]
|
57
55
|
|
58
|
-
dscontents = [
|
56
|
+
dscontents = [Sisimai::MSP.DELIVERYSTATUS]
|
59
57
|
hasdivided = mbody.split("\n")
|
60
|
-
havepassed = ['']
|
61
|
-
|
62
|
-
|
63
|
-
previousfn = '' # (String) Previous field name
|
58
|
+
havepassed = ['']
|
59
|
+
rfc822list = [] # (Array) Each line in message/rfc822 part string
|
60
|
+
blanklines = 0 # (Integer) The number of blank lines
|
64
61
|
readcursor = 0 # (Integer) Points the current cursor position
|
65
62
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
66
63
|
commandset = [] # (Array) ``in reply to * command'' list
|
@@ -73,12 +70,13 @@ module Sisimai
|
|
73
70
|
|
74
71
|
hasdivided.each do |e|
|
75
72
|
# Save the current line for the next loop
|
76
|
-
havepassed << e
|
73
|
+
havepassed << e
|
74
|
+
p = havepassed[-2]
|
77
75
|
|
78
76
|
if readcursor == 0
|
79
77
|
# Beginning of the bounce message or delivery status part
|
80
78
|
if e =~ Re1[:begin]
|
81
|
-
readcursor |= Indicators[:
|
79
|
+
readcursor |= Indicators[:deliverystatus]
|
82
80
|
next
|
83
81
|
end
|
84
82
|
end
|
@@ -93,30 +91,16 @@ module Sisimai
|
|
93
91
|
|
94
92
|
if readcursor & Indicators[:'message-rfc822'] > 0
|
95
93
|
# After "message/rfc822"
|
96
|
-
if
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
next unless RFC822Head.key?(lhs)
|
101
|
-
|
102
|
-
previousfn = lhs
|
103
|
-
rfc822part += e + "\n"
|
104
|
-
|
105
|
-
elsif e =~ /\A[ \t]+/
|
106
|
-
# Continued line from the previous line
|
107
|
-
next if rfc822next[previousfn]
|
108
|
-
rfc822part += e + "\n" if LongFields.key?(previousfn)
|
109
|
-
|
110
|
-
else
|
111
|
-
# Check the end of headers in rfc822 part
|
112
|
-
next unless LongFields.key?(previousfn)
|
113
|
-
next unless e.empty?
|
114
|
-
rfc822next[previousfn] = true
|
94
|
+
if e.empty?
|
95
|
+
blanklines += 1
|
96
|
+
break if blanklines > 1
|
97
|
+
next
|
115
98
|
end
|
99
|
+
rfc822list << e
|
116
100
|
|
117
101
|
else
|
118
102
|
# Before "message/rfc822"
|
119
|
-
next if readcursor & Indicators[:
|
103
|
+
next if readcursor & Indicators[:deliverystatus] == 0
|
120
104
|
next if e.empty?
|
121
105
|
|
122
106
|
if connvalues == connheader.keys.size
|
@@ -203,43 +187,25 @@ module Sisimai
|
|
203
187
|
end
|
204
188
|
end
|
205
189
|
end
|
206
|
-
|
207
190
|
return nil if recipients == 0
|
208
191
|
require 'sisimai/string'
|
209
|
-
require 'sisimai/smtp/status'
|
210
192
|
|
211
193
|
dscontents.map do |e|
|
212
194
|
# Set default values if each value is empty.
|
213
195
|
connheader.each_key { |a| e[a] ||= connheader[a] || '' }
|
214
|
-
e['command']
|
215
|
-
|
216
|
-
if mhead['received'].size > 0
|
217
|
-
# Get localhost and remote host name from Received header.
|
218
|
-
r0 = mhead['received']
|
219
|
-
%w|lhost rhost|.each { |a| e[a] ||= '' }
|
220
|
-
e['lhost'] = Sisimai::RFC5322.received(r0[0]).shift if e['lhost'].empty?
|
221
|
-
e['rhost'] = Sisimai::RFC5322.received(r0[-1]).pop if e['rhost'].empty?
|
222
|
-
end
|
223
|
-
|
224
|
-
e['spec'] ||= 'SMTP'
|
196
|
+
e['command'] = commandset.shift || ''
|
225
197
|
e['agent'] = Sisimai::MSP::UK::MessageLabs.smtpagent
|
226
|
-
e['status'] ||= ''
|
227
198
|
e['diagnosis'] = Sisimai::String.sweep(e['diagnosis'])
|
228
199
|
|
229
200
|
ReFailure.each_key do |r|
|
230
201
|
# Verify each regular expression of session errors
|
231
202
|
next unless e['diagnosis'] =~ ReFailure[r]
|
232
|
-
e['reason'] = r
|
203
|
+
e['reason'] = r.to_s
|
233
204
|
break
|
234
205
|
end
|
235
|
-
|
236
|
-
if e['status'].empty? || e['status'] =~ /\A\d[.]0[.]0\z/
|
237
|
-
# There is no value of Status header or the value is 5.0.0, 4.0.0
|
238
|
-
r = Sisimai::SMTP::Status.find(e['diagnosis'])
|
239
|
-
e['status'] = r if r.size > 0
|
240
|
-
end
|
241
206
|
end
|
242
207
|
|
208
|
+
rfc822part = Sisimai::RFC5322.weedout(rfc822list)
|
243
209
|
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
244
210
|
end
|
245
211
|
|
@@ -20,11 +20,9 @@ module Sisimai
|
|
20
20
|
:endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
|
21
21
|
}
|
22
22
|
ReFailure = {
|
23
|
-
|
23
|
+
expired: %r/Delivery[ ]expired/x,
|
24
24
|
}
|
25
25
|
Indicators = Sisimai::MSP.INDICATORS
|
26
|
-
LongFields = Sisimai::RFC5322.LONGFIELDS
|
27
|
-
RFC822Head = Sisimai::RFC5322.HEADERFIELDS
|
28
26
|
|
29
27
|
def description; return 'Amazon SES(Sending): http://aws.amazon.com/ses/'; end
|
30
28
|
def smtpagent; return 'US::AmazonSES'; end
|
@@ -51,12 +49,11 @@ module Sisimai
|
|
51
49
|
return nil unless mbody
|
52
50
|
return nil unless mhead['x-aws-outgoing']
|
53
51
|
|
54
|
-
dscontents = [
|
52
|
+
dscontents = [Sisimai::MSP.DELIVERYSTATUS]
|
55
53
|
hasdivided = mbody.split("\n")
|
56
|
-
havepassed = ['']
|
57
|
-
|
58
|
-
|
59
|
-
previousfn = '' # (String) Previous field name
|
54
|
+
havepassed = ['']
|
55
|
+
rfc822list = [] # (Array) Each line in message/rfc822 part string
|
56
|
+
blanklines = 0 # (Integer) The number of blank lines
|
60
57
|
readcursor = 0 # (Integer) Points the current cursor position
|
61
58
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
62
59
|
connvalues = 0 # (Integer) Flag, 1 if all the value of $connheader have been set
|
@@ -67,12 +64,13 @@ module Sisimai
|
|
67
64
|
|
68
65
|
hasdivided.each do |e|
|
69
66
|
# Save the current line for the next loop
|
70
|
-
havepassed << e
|
67
|
+
havepassed << e
|
68
|
+
p = havepassed[-2]
|
71
69
|
|
72
70
|
if readcursor == 0
|
73
71
|
# Beginning of the bounce message or delivery status part
|
74
72
|
if e =~ Re1[:begin]
|
75
|
-
readcursor |= Indicators[:
|
73
|
+
readcursor |= Indicators[:deliverystatus]
|
76
74
|
next
|
77
75
|
end
|
78
76
|
end
|
@@ -87,30 +85,17 @@ module Sisimai
|
|
87
85
|
|
88
86
|
if readcursor & Indicators[:'message-rfc822'] > 0
|
89
87
|
# After "message/rfc822"
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
next
|
95
|
-
|
96
|
-
previousfn = lhs
|
97
|
-
rfc822part += e + "\n"
|
98
|
-
|
99
|
-
elsif e =~ /\A[ \t]+/
|
100
|
-
# Continued line from the previous line
|
101
|
-
next if rfc822next[previousfn]
|
102
|
-
rfc822part += e + "\n" if LongFields.key?(previousfn)
|
103
|
-
|
104
|
-
else
|
105
|
-
# Check the end of headers in rfc822 part
|
106
|
-
next unless LongFields.key?(previousfn)
|
107
|
-
next unless e.empty?
|
108
|
-
rfc822next[previousfn] = true
|
88
|
+
# After "message/rfc822"
|
89
|
+
if e.empty?
|
90
|
+
blanklines += 1
|
91
|
+
break if blanklines > 1
|
92
|
+
next
|
109
93
|
end
|
94
|
+
rfc822list << e
|
110
95
|
|
111
96
|
else
|
112
97
|
# Before "message/rfc822"
|
113
|
-
next if readcursor & Indicators[:
|
98
|
+
next if readcursor & Indicators[:deliverystatus] == 0
|
114
99
|
next if e.empty?
|
115
100
|
|
116
101
|
if connvalues == connheader.keys.size
|
@@ -203,13 +188,6 @@ module Sisimai
|
|
203
188
|
# Set default values if each value is empty.
|
204
189
|
connheader.each_key { |a| e[a] ||= connheader[a] || '' }
|
205
190
|
|
206
|
-
if mhead['received'].size > 0
|
207
|
-
# Get localhost and remote host name from Received header.
|
208
|
-
r0 = mhead['received']
|
209
|
-
%w|lhost rhost|.each { |a| e[a] ||= '' }
|
210
|
-
e['lhost'] = Sisimai::RFC5322.received(r0[0]).shift if e['lhost'].empty?
|
211
|
-
e['rhost'] = Sisimai::RFC5322.received(r0[-1]).pop if e['rhost'].empty?
|
212
|
-
end
|
213
191
|
e['diagnosis'] = e['diagnosis'].gsub(/\\n/, ' ')
|
214
192
|
e['diagnosis'] = Sisimai::String.sweep(e['diagnosis'])
|
215
193
|
|
@@ -229,15 +207,15 @@ module Sisimai
|
|
229
207
|
ReFailure.each_key do |r|
|
230
208
|
# Verify each regular expression of session errors
|
231
209
|
next unless e['diagnosis'] =~ ReFailure[r]
|
232
|
-
e['reason'] = r
|
210
|
+
e['reason'] = r.to_s
|
233
211
|
break
|
234
212
|
end
|
235
213
|
|
236
214
|
e['reason'] ||= Sisimai::SMTP::Status.name(e['status'])
|
237
|
-
e['
|
238
|
-
e['agent'] = Sisimai::MSP::US::AmazonSES.smtpagent
|
215
|
+
e['agent'] = Sisimai::MSP::US::AmazonSES.smtpagent
|
239
216
|
end
|
240
217
|
|
218
|
+
rfc822part = Sisimai::RFC5322.weedout(rfc822list)
|
241
219
|
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
242
220
|
end
|
243
221
|
|
@@ -20,8 +20,6 @@ module Sisimai
|
|
20
20
|
:endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
|
21
21
|
}
|
22
22
|
Indicators = Sisimai::MSP.INDICATORS
|
23
|
-
LongFields = Sisimai::RFC5322.LONGFIELDS
|
24
|
-
RFC822Head = Sisimai::RFC5322.HEADERFIELDS
|
25
23
|
|
26
24
|
def description; return 'Amazon WorkMail: https://aws.amazon.com/workmail/'; end
|
27
25
|
def smtpagent; return 'US::AmazonWorkMail'; end
|
@@ -69,11 +67,10 @@ module Sisimai
|
|
69
67
|
mbody = Sisimai::MIME.qprintd(mbody)
|
70
68
|
end
|
71
69
|
|
72
|
-
dscontents = [
|
70
|
+
dscontents = [Sisimai::MSP.DELIVERYSTATUS]
|
73
71
|
hasdivided = mbody.split("\n")
|
74
|
-
|
75
|
-
|
76
|
-
previousfn = '' # (String) Previous field name
|
72
|
+
rfc822list = [] # (Array) Each line in message/rfc822 part string
|
73
|
+
blanklines = 0 # (Integer) The number of blank lines
|
77
74
|
readcursor = 0 # (Integer) Points the current cursor position
|
78
75
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
79
76
|
connvalues = 0 # (Integer) Flag, 1 if all the value of $connheader have been set
|
@@ -86,7 +83,7 @@ module Sisimai
|
|
86
83
|
if readcursor == 0
|
87
84
|
# Beginning of the bounce message or delivery status part
|
88
85
|
if e =~ Re1[:begin]
|
89
|
-
readcursor |= Indicators[:
|
86
|
+
readcursor |= Indicators[:deliverystatus]
|
90
87
|
next
|
91
88
|
end
|
92
89
|
end
|
@@ -101,30 +98,16 @@ module Sisimai
|
|
101
98
|
|
102
99
|
if readcursor & Indicators[:'message-rfc822'] > 0
|
103
100
|
# After "message/rfc822"
|
104
|
-
if
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
next unless RFC822Head.key?(lhs)
|
109
|
-
|
110
|
-
previousfn = lhs
|
111
|
-
rfc822part += e + "\n"
|
112
|
-
|
113
|
-
elsif e =~ /\A[ \t]+/
|
114
|
-
# Continued line from the previous line
|
115
|
-
next if rfc822next[previousfn]
|
116
|
-
rfc822part += e + "\n" if LongFields.key?(previousfn)
|
117
|
-
|
118
|
-
else
|
119
|
-
# Check the end of headers in rfc822 part
|
120
|
-
next unless LongFields.key?(previousfn)
|
121
|
-
next unless e.empty?
|
122
|
-
rfc822next[previousfn] = true
|
101
|
+
if e.empty?
|
102
|
+
blanklines += 1
|
103
|
+
break if blanklines > 1
|
104
|
+
next
|
123
105
|
end
|
106
|
+
rfc822list << e
|
124
107
|
|
125
108
|
else
|
126
109
|
# Before "message/rfc822"
|
127
|
-
next if readcursor & Indicators[:
|
110
|
+
next if readcursor & Indicators[:deliverystatus] == 0
|
128
111
|
next if e.empty?
|
129
112
|
|
130
113
|
if connvalues == connheader.keys.size
|
@@ -188,13 +171,6 @@ module Sisimai
|
|
188
171
|
# Set default values if each value is empty.
|
189
172
|
connheader.each_key { |a| e[a] ||= connheader[a] || '' }
|
190
173
|
|
191
|
-
if mhead['received'].size > 0
|
192
|
-
# Get localhost and remote host name from Received header.
|
193
|
-
r0 = mhead['received']
|
194
|
-
%w|lhost rhost|.each { |a| e[a] ||= '' }
|
195
|
-
e['lhost'] = Sisimai::RFC5322.received(r0[0]).shift if e['lhost'].empty?
|
196
|
-
e['rhost'] = Sisimai::RFC5322.received(r0[-1]).pop if e['rhost'].empty?
|
197
|
-
end
|
198
174
|
e['diagnosis'] = Sisimai::String.sweep(e['diagnosis'])
|
199
175
|
|
200
176
|
if e['status'] =~ /\A[45][.][01][.]0\z/
|
@@ -209,11 +185,17 @@ module Sisimai
|
|
209
185
|
e['status'] = pseudostatus if pseudostatus.size > 0
|
210
186
|
end
|
211
187
|
|
188
|
+
if cv = e['diagnosis'].match(/[<]([245]\d\d)[ ].+[>]/)
|
189
|
+
# 554 4.4.7 Message expired: unable to deliver in 840 minutes.
|
190
|
+
# <421 4.4.2 Connection timed out>
|
191
|
+
e['replycode'] = cv[1]
|
192
|
+
end
|
193
|
+
|
212
194
|
e['reason'] ||= Sisimai::SMTP::Status.name(e['status'])
|
213
|
-
e['spec'] ||= 'SMTP'
|
214
195
|
e['agent'] = Sisimai::MSP::US::AmazonWorkMail.smtpagent
|
215
196
|
end
|
216
197
|
|
198
|
+
rfc822part = Sisimai::RFC5322.weedout(rfc822list)
|
217
199
|
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
218
200
|
end
|
219
201
|
|
data/lib/sisimai/msp/us/aol.rb
CHANGED
@@ -18,11 +18,9 @@ module Sisimai
|
|
18
18
|
:endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
|
19
19
|
}
|
20
20
|
ReFailure = {
|
21
|
-
|
21
|
+
hostunknown: %r/Host[ ]or[ ]domain[ ]name[ ]not[ ]found/,
|
22
22
|
}
|
23
23
|
Indicators = Sisimai::MSP.INDICATORS
|
24
|
-
LongFields = Sisimai::RFC5322.LONGFIELDS
|
25
|
-
RFC822Head = Sisimai::RFC5322.HEADERFIELDS
|
26
24
|
|
27
25
|
def description; return 'Aol Mail: http://www.aol.com'; end
|
28
26
|
def smtpagent; return 'US::Aol'; end
|
@@ -56,12 +54,11 @@ module Sisimai
|
|
56
54
|
return nil unless mbody
|
57
55
|
return nil unless mhead['x-aol-ip']
|
58
56
|
|
59
|
-
dscontents = [
|
57
|
+
dscontents = [Sisimai::MSP.DELIVERYSTATUS]
|
60
58
|
hasdivided = mbody.split("\n")
|
61
|
-
havepassed = ['']
|
62
|
-
|
63
|
-
|
64
|
-
previousfn = '' # (String) Previous field name
|
59
|
+
havepassed = ['']
|
60
|
+
rfc822list = [] # (Array) Each line in message/rfc822 part string
|
61
|
+
blanklines = 0 # (Integer) The number of blank lines
|
65
62
|
readcursor = 0 # (Integer) Points the current cursor position
|
66
63
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
67
64
|
connvalues = 0 # (Integer) Flag, 1 if all the value of $connheader have been set
|
@@ -73,12 +70,13 @@ module Sisimai
|
|
73
70
|
|
74
71
|
hasdivided.each do |e|
|
75
72
|
# Save the current line for the next loop
|
76
|
-
havepassed << e
|
73
|
+
havepassed << e
|
74
|
+
p = havepassed[-2]
|
77
75
|
|
78
76
|
if readcursor == 0
|
79
77
|
# Beginning of the bounce message or delivery status part
|
80
78
|
if e =~ Re1[:begin]
|
81
|
-
readcursor |= Indicators[:
|
79
|
+
readcursor |= Indicators[:deliverystatus]
|
82
80
|
next
|
83
81
|
end
|
84
82
|
end
|
@@ -93,30 +91,16 @@ module Sisimai
|
|
93
91
|
|
94
92
|
if readcursor & Indicators[:'message-rfc822'] > 0
|
95
93
|
# After "message/rfc822"
|
96
|
-
if
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
next unless RFC822Head.key?(lhs)
|
101
|
-
|
102
|
-
previousfn = lhs
|
103
|
-
rfc822part += e + "\n"
|
104
|
-
|
105
|
-
elsif e =~ /\A[ \t]+/
|
106
|
-
# Continued line from the previous line
|
107
|
-
next if rfc822next[previousfn]
|
108
|
-
rfc822part += e + "\n" if LongFields.key?(previousfn)
|
109
|
-
|
110
|
-
else
|
111
|
-
# Check the end of headers in rfc822 part
|
112
|
-
next unless LongFields.key?(previousfn)
|
113
|
-
next unless e.empty?
|
114
|
-
rfc822next[previousfn] = true
|
94
|
+
if e.empty?
|
95
|
+
blanklines += 1
|
96
|
+
break if blanklines > 1
|
97
|
+
next
|
115
98
|
end
|
99
|
+
rfc822list << e
|
116
100
|
|
117
101
|
else
|
118
102
|
# Before "message/rfc822"
|
119
|
-
next if readcursor & Indicators[:
|
103
|
+
next if readcursor & Indicators[:deliverystatus] == 0
|
120
104
|
next if e.empty?
|
121
105
|
|
122
106
|
if connvalues == connheader.keys.size
|
@@ -198,20 +182,14 @@ module Sisimai
|
|
198
182
|
# Set default values if each value is empty.
|
199
183
|
connheader.each_key { |a| e[a] ||= connheader[a] || '' }
|
200
184
|
|
201
|
-
|
202
|
-
# Get localhost and remote host name from Received header.
|
203
|
-
r0 = mhead['received']
|
204
|
-
%w|lhost rhost|.each { |a| e[a] ||= '' }
|
205
|
-
e['lhost'] = Sisimai::RFC5322.received(r0[0]).shift if e['lhost'].empty?
|
206
|
-
e['rhost'] = Sisimai::RFC5322.received(r0[-1]).pop if e['rhost'].empty?
|
207
|
-
end
|
185
|
+
e['agent'] = Sisimai::MSP::US::Aol.smtpagent
|
208
186
|
e['diagnosis'] = e['diagnosis'].gsub(/\\n/, ' ')
|
209
187
|
e['diagnosis'] = Sisimai::String.sweep(e['diagnosis'])
|
210
188
|
|
211
189
|
ReFailure.each_key do |r|
|
212
190
|
# Verify each regular expression of session errors
|
213
191
|
next unless e['diagnosis'] =~ ReFailure[r]
|
214
|
-
e['reason'] = r
|
192
|
+
e['reason'] = r.to_s
|
215
193
|
break
|
216
194
|
end
|
217
195
|
|
@@ -220,11 +198,9 @@ module Sisimai
|
|
220
198
|
pseudostatus = Sisimai::SMTP::Status.find(e['diagnosis'])
|
221
199
|
e['status'] = pseudostatus if pseudostatus.size > 0
|
222
200
|
end
|
223
|
-
|
224
|
-
e['spec'] ||= 'SMTP'
|
225
|
-
e['agent'] = Sisimai::MSP::US::Aol.smtpagent
|
226
201
|
end
|
227
202
|
|
203
|
+
rfc822part = Sisimai::RFC5322.weedout(rfc822list)
|
228
204
|
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
229
205
|
end
|
230
206
|
end
|