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/domino.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/delivery-status'],
|
13
|
-
}.freeze
|
10
|
+
ReBackbone = %r|^Content-Type:[ ]message/delivery-status|.freeze
|
11
|
+
StartingOf = { message: ['Your message'] }.freeze
|
14
12
|
MessagesOf = {
|
15
13
|
'userunknown' => [
|
16
14
|
'not listed in Domino Directory',
|
@@ -40,86 +38,65 @@ module Sisimai::Lhost
|
|
40
38
|
return nil unless mhead['subject'].start_with?('DELIVERY FAILURE:')
|
41
39
|
|
42
40
|
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
43
|
-
|
44
|
-
|
45
|
-
blanklines = 0 # (Integer) The number of blank lines
|
41
|
+
emailsteak = Sisimai::RFC5322.fillet(mbody, ReBackbone)
|
42
|
+
bodyslices = emailsteak[0].split("\n")
|
46
43
|
readcursor = 0 # (Integer) Points the current cursor position
|
47
44
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
48
45
|
subjecttxt = '' # (String) The value of Subject:
|
49
46
|
v = nil
|
50
47
|
|
51
|
-
while e =
|
48
|
+
while e = bodyslices.shift do
|
49
|
+
# Read error messages and delivery status lines from the head of the email
|
50
|
+
# to the previous line of the beginning of the original message.
|
52
51
|
next if e.empty?
|
53
52
|
|
54
53
|
if readcursor == 0
|
55
54
|
# Beginning of the bounce message or delivery status part
|
56
|
-
if e.start_with?(StartingOf[:message][0])
|
57
|
-
|
58
|
-
next
|
59
|
-
end
|
55
|
+
readcursor |= Indicators[:deliverystatus] if e.start_with?(StartingOf[:message][0])
|
56
|
+
next
|
60
57
|
end
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
58
|
+
next if (readcursor & Indicators[:deliverystatus]) == 0
|
59
|
+
|
60
|
+
# Your message
|
61
|
+
#
|
62
|
+
# Subject: Test Bounce
|
63
|
+
#
|
64
|
+
# was not delivered to:
|
65
|
+
#
|
66
|
+
# kijitora@example.net
|
67
|
+
#
|
68
|
+
# because:
|
69
|
+
#
|
70
|
+
# User some.name (kijitora@example.net) not listed in Domino Directory
|
71
|
+
#
|
72
|
+
v = dscontents[-1]
|
73
|
+
|
74
|
+
if e.start_with?('was not delivered to:')
|
75
|
+
# was not delivered to:
|
76
|
+
if v['recipient']
|
77
|
+
# There are multiple recipient addresses in the message body.
|
78
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
79
|
+
v = dscontents[-1]
|
67
80
|
end
|
68
|
-
|
81
|
+
v['recipient'] ||= e
|
82
|
+
recipients += 1
|
69
83
|
|
70
|
-
|
71
|
-
#
|
72
|
-
if e.empty?
|
73
|
-
blanklines += 1
|
74
|
-
break if blanklines > 1
|
75
|
-
next
|
76
|
-
end
|
77
|
-
rfc822list << e
|
78
|
-
else
|
79
|
-
# Error message part
|
80
|
-
next if (readcursor & Indicators[:deliverystatus]) == 0
|
81
|
-
|
82
|
-
# Your message
|
83
|
-
#
|
84
|
-
# Subject: Test Bounce
|
85
|
-
#
|
86
|
-
# was not delivered to:
|
87
|
-
#
|
84
|
+
elsif cv = e.match(/\A[ ][ ]([^ ]+[@][^ ]+)\z/)
|
85
|
+
# Continued from the line "was not delivered to:"
|
88
86
|
# kijitora@example.net
|
89
|
-
|
87
|
+
v['recipient'] = Sisimai::Address.s3s4(cv[1])
|
88
|
+
|
89
|
+
elsif e.start_with?('because:')
|
90
90
|
# because:
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
if e.start_with?('was not delivered to:')
|
97
|
-
# was not delivered to:
|
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['recipient'] ||= e
|
104
|
-
recipients += 1
|
105
|
-
|
106
|
-
elsif cv = e.match(/\A[ ][ ]([^ ]+[@][^ ]+)\z/)
|
107
|
-
# Continued from the line "was not delivered to:"
|
108
|
-
# kijitora@example.net
|
109
|
-
v['recipient'] = Sisimai::Address.s3s4(cv[1])
|
110
|
-
|
111
|
-
elsif e.start_with?('because:')
|
112
|
-
# because:
|
91
|
+
v['diagnosis'] = e
|
92
|
+
else
|
93
|
+
if v['diagnosis'].to_s == 'because:'
|
94
|
+
# Error message, continued from the line "because:"
|
113
95
|
v['diagnosis'] = e
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
elsif cv = e.match(/\A[ ][ ]Subject: (.+)\z/)
|
120
|
-
# Subject: Nyaa
|
121
|
-
subjecttxt = cv[1]
|
122
|
-
end
|
96
|
+
|
97
|
+
elsif cv = e.match(/\A[ ][ ]Subject: (.+)\z/)
|
98
|
+
# Subject: Nyaa
|
99
|
+
subjecttxt = cv[1]
|
123
100
|
end
|
124
101
|
end
|
125
102
|
end
|
@@ -140,14 +117,11 @@ module Sisimai::Lhost
|
|
140
117
|
e.each_key { |a| e[a] ||= '' }
|
141
118
|
end
|
142
119
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
rfc822list << ('Subject: ' << subjecttxt)
|
147
|
-
end
|
120
|
+
# Set the value of subjecttxt as a Subject if there is no original
|
121
|
+
# message in the bounce mail.
|
122
|
+
emailsteak[1] << ('Subject: ' << subjecttxt << "\n") unless emailsteak[1] =~ /^Subject: /
|
148
123
|
|
149
|
-
|
150
|
-
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
124
|
+
return { 'ds' => dscontents, 'rfc822' => emailsteak[1] }
|
151
125
|
end
|
152
126
|
|
153
127
|
end
|
@@ -7,10 +7,10 @@ module Sisimai::Lhost
|
|
7
7
|
require 'sisimai/lhost'
|
8
8
|
|
9
9
|
Indicators = Sisimai::Lhost.INDICATORS
|
10
|
+
ReBackbone = %r|^---[ ]The[ ]header[ ]of[ ]the[ ]original[ ]message[ ]is[ ]following[.][ ]---|.freeze
|
10
11
|
StartingOf = {
|
11
12
|
message: ['This message was created automatically by mail delivery software'],
|
12
13
|
error: ['For the following reason:'],
|
13
|
-
rfc822: ['--- The header of the original message is following'],
|
14
14
|
}.freeze
|
15
15
|
MessagesOf = { 'mesgtoobig' => ['Mail size limit exceeded'] }.freeze
|
16
16
|
|
@@ -34,77 +34,80 @@ module Sisimai::Lhost
|
|
34
34
|
return nil unless mhead['subject'] == 'Mail delivery failed: returning message to sender'
|
35
35
|
|
36
36
|
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
37
|
-
|
38
|
-
|
39
|
-
blanklines = 0 # (Integer) The number of blank lines
|
37
|
+
emailsteak = Sisimai::RFC5322.fillet(mbody, ReBackbone)
|
38
|
+
bodyslices = emailsteak[0].split("\n")
|
40
39
|
readcursor = 0 # (Integer) Points the current cursor position
|
41
40
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
42
41
|
v = nil
|
43
42
|
|
44
|
-
while e =
|
43
|
+
while e = bodyslices.shift do
|
44
|
+
# Read error messages and delivery status lines from the head of the email
|
45
|
+
# to the previous line of the beginning of the original message.
|
46
|
+
|
45
47
|
if readcursor == 0
|
46
48
|
# Beginning of the bounce message or delivery status part
|
47
|
-
if e.start_with?(StartingOf[:message][0])
|
48
|
-
|
49
|
-
next
|
50
|
-
end
|
49
|
+
readcursor |= Indicators[:deliverystatus] if e.start_with?(StartingOf[:message][0])
|
50
|
+
next
|
51
51
|
end
|
52
|
+
next if (readcursor & Indicators[:deliverystatus]) == 0
|
53
|
+
next if e.empty?
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
# The following address failed:
|
56
|
+
#
|
57
|
+
# general@example.eu
|
58
|
+
#
|
59
|
+
# For the following reason:
|
60
|
+
#
|
61
|
+
# Mail size limit exceeded. For explanation visit
|
62
|
+
# http://postmaster.1and1.com/en/error-messages?ip=%1s
|
63
|
+
v = dscontents[-1]
|
60
64
|
|
61
|
-
if
|
62
|
-
#
|
63
|
-
if
|
64
|
-
|
65
|
-
|
66
|
-
|
65
|
+
if cv = e.match(/\A([^ ]+[@][^ ]+)\z/)
|
66
|
+
# general@example.eu
|
67
|
+
if v['recipient']
|
68
|
+
# There are multiple recipient addresses in the message body.
|
69
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
70
|
+
v = dscontents[-1]
|
67
71
|
end
|
68
|
-
|
69
|
-
|
70
|
-
# Error message part
|
71
|
-
next if (readcursor & Indicators[:deliverystatus]) == 0
|
72
|
-
next if e.empty?
|
72
|
+
v['recipient'] = cv[1]
|
73
|
+
recipients += 1
|
73
74
|
|
74
|
-
|
75
|
-
#
|
76
|
-
# general@example.eu
|
77
|
-
#
|
75
|
+
elsif e.start_with?(StartingOf[:error][0])
|
78
76
|
# For the following reason:
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
v = dscontents[-1]
|
83
|
-
|
84
|
-
if cv = e.match(/\A([^ ]+[@][^ ]+)\z/)
|
85
|
-
# general@example.eu
|
86
|
-
if v['recipient']
|
87
|
-
# There are multiple recipient addresses in the message body.
|
88
|
-
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
89
|
-
v = dscontents[-1]
|
90
|
-
end
|
91
|
-
v['recipient'] = cv[1]
|
92
|
-
recipients += 1
|
93
|
-
|
94
|
-
elsif e.start_with?(StartingOf[:error][0])
|
95
|
-
# For the following reason:
|
96
|
-
v['diagnosis'] = e
|
97
|
-
else
|
77
|
+
v['diagnosis'] = e
|
78
|
+
else
|
79
|
+
if v['diagnosis']
|
98
80
|
# Get error message and append error message strings
|
99
|
-
v['diagnosis'] << ' ' << e
|
81
|
+
v['diagnosis'] << ' ' << e
|
82
|
+
else
|
83
|
+
# OR the following format:
|
84
|
+
# neko@example.fr:
|
85
|
+
# SMTP error from remote server for TEXT command, host: ...
|
86
|
+
v['alterrors'] ||= ''
|
87
|
+
v['alterrors'] << ' ' << e
|
100
88
|
end
|
101
89
|
end
|
102
90
|
end
|
103
91
|
return nil unless recipients > 0
|
104
92
|
|
105
93
|
dscontents.each do |e|
|
106
|
-
e['agent']
|
107
|
-
e['diagnosis']
|
94
|
+
e['agent'] = self.smtpagent
|
95
|
+
e['diagnosis'] ||= ''
|
96
|
+
e['diagnosis'] = e['alterrors'] if e['diagnosis'].empty?
|
97
|
+
|
98
|
+
if cv = e['diagnosis'].match(/host:[ ]+(.+?)[ ]+.+[ ]+reason:.+/)
|
99
|
+
# SMTP error from remote server for TEXT command,
|
100
|
+
# host: smtp-in.orange.fr (193.252.22.65)
|
101
|
+
# reason: 550 5.2.0 Mail rejete. Mail rejected. ofr_506 [506]
|
102
|
+
e['rhost'] = cv[1]
|
103
|
+
e['command'] = 'DATA' if e['diagnosis'] =~ /for TEXT command/
|
104
|
+
e['spec'] = 'SMTP' if e['diagnosis'] =~ /SMTP error/
|
105
|
+
e['status'] = Sisimai::SMTP::Status.find(e['diagnosis'])
|
106
|
+
else
|
107
|
+
# For the following reason:
|
108
|
+
e['diagnosis'].gsub(/\A#{StartingOf[:error][0]}/, '')
|
109
|
+
end
|
110
|
+
e['diagnosis'] = Sisimai::String.sweep(e['diagnosis'])
|
108
111
|
|
109
112
|
MessagesOf.each_key do |r|
|
110
113
|
# Verify each regular expression of session errors
|
@@ -114,8 +117,7 @@ module Sisimai::Lhost
|
|
114
117
|
end
|
115
118
|
end
|
116
119
|
|
117
|
-
|
118
|
-
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
120
|
+
return { 'ds' => dscontents, 'rfc822' => emailsteak[1] }
|
119
121
|
end
|
120
122
|
|
121
123
|
end
|
@@ -8,10 +8,10 @@ module Sisimai::Lhost
|
|
8
8
|
require 'sisimai/lhost'
|
9
9
|
|
10
10
|
Indicators = Sisimai::Lhost.INDICATORS
|
11
|
+
ReBackbone = %r|^Content-Type:[ ]message/rfc822|.freeze
|
11
12
|
StartingOf = {
|
12
13
|
message: ['Your message'],
|
13
14
|
error: ['did not reach the following recipient(s):'],
|
14
|
-
rfc822: ['Content-Type: message/rfc822'],
|
15
15
|
}.freeze
|
16
16
|
ErrorCodes = {
|
17
17
|
'onhold' => [
|
@@ -92,9 +92,8 @@ module Sisimai::Lhost
|
|
92
92
|
return nil unless match > 0
|
93
93
|
|
94
94
|
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
95
|
-
|
96
|
-
|
97
|
-
blanklines = 0 # (Integer) The number of blank lines
|
95
|
+
emailsteak = Sisimai::RFC5322.fillet(mbody, ReBackbone)
|
96
|
+
bodyslices = emailsteak[0].split("\n")
|
98
97
|
readcursor = 0 # (Integer) Points the current cursor position
|
99
98
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
100
99
|
statuspart = false # (Boolean) Flag, true = have got delivery status part.
|
@@ -106,108 +105,88 @@ module Sisimai::Lhost
|
|
106
105
|
}
|
107
106
|
v = nil
|
108
107
|
|
109
|
-
while e =
|
108
|
+
while e = bodyslices.shift do
|
109
|
+
# Read error messages and delivery status lines from the head of the email
|
110
|
+
# to the previous line of the beginning of the original message.
|
110
111
|
if readcursor == 0
|
111
112
|
# Beginning of the bounce message or delivery status part
|
112
|
-
if e.start_with?(StartingOf[:message][0])
|
113
|
-
|
114
|
-
next
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
if (readcursor & Indicators[:'message-rfc822']) == 0
|
119
|
-
# Beginning of the original message part
|
120
|
-
if e.start_with?(StartingOf[:rfc822][0])
|
121
|
-
readcursor |= Indicators[:'message-rfc822']
|
122
|
-
next
|
123
|
-
end
|
113
|
+
readcursor |= Indicators[:deliverystatus] if e.start_with?(StartingOf[:message][0])
|
114
|
+
next
|
124
115
|
end
|
116
|
+
next if (readcursor & Indicators[:deliverystatus]) == 0
|
117
|
+
next if statuspart
|
118
|
+
|
119
|
+
if connvalues == connheader.keys.size
|
120
|
+
# did not reach the following recipient(s):
|
121
|
+
#
|
122
|
+
# kijitora@example.co.jp on Thu, 29 Apr 2007 16:51:51 -0500
|
123
|
+
# The recipient name is not recognized
|
124
|
+
# The MTS-ID of the original message is: c=jp;a= ;p=neko
|
125
|
+
# ;l=EXCHANGE000000000000000000
|
126
|
+
# MSEXCH:IMS:KIJITORA CAT:EXAMPLE:EXCHANGE 0 (000C05A6) Unknown Recipient
|
127
|
+
# mikeneko@example.co.jp on Thu, 29 Apr 2007 16:51:51 -0500
|
128
|
+
# The recipient name is not recognized
|
129
|
+
# The MTS-ID of the original message is: c=jp;a= ;p=neko
|
130
|
+
# ;l=EXCHANGE000000000000000000
|
131
|
+
# MSEXCH:IMS:KIJITORA CAT:EXAMPLE:EXCHANGE 0 (000C05A6) Unknown Recipient
|
132
|
+
v = dscontents[-1]
|
125
133
|
|
126
|
-
|
127
|
-
|
128
|
-
if e.empty?
|
129
|
-
blanklines += 1
|
130
|
-
break if blanklines > 1
|
131
|
-
next
|
132
|
-
end
|
133
|
-
rfc822list << e
|
134
|
-
else
|
135
|
-
# Error message part
|
136
|
-
next if (readcursor & Indicators[:deliverystatus]) == 0
|
137
|
-
next if statuspart
|
138
|
-
|
139
|
-
if connvalues == connheader.keys.size
|
140
|
-
# did not reach the following recipient(s):
|
141
|
-
#
|
134
|
+
if cv = e.match(/\A[ \t]*([^ ]+[@][^ ]+) on[ \t]*.*\z/) ||
|
135
|
+
e.match(/\A[ \t]*.+(?:SMTP|smtp)=([^ ]+[@][^ ]+) on[ \t]*.*\z/)
|
142
136
|
# kijitora@example.co.jp on Thu, 29 Apr 2007 16:51:51 -0500
|
143
|
-
#
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
v = dscontents[-1]
|
153
|
-
|
154
|
-
if cv = e.match(/\A[ \t]*([^ ]+[@][^ ]+) on[ \t]*.*\z/) ||
|
155
|
-
e.match(/\A[ \t]*.+(?:SMTP|smtp)=([^ ]+[@][^ ]+) on[ \t]*.*\z/)
|
156
|
-
# kijitora@example.co.jp on Thu, 29 Apr 2007 16:51:51 -0500
|
157
|
-
# kijitora@example.com on 4/29/99 9:19:59 AM
|
158
|
-
if v['recipient']
|
159
|
-
# There are multiple recipient addresses in the message body.
|
160
|
-
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
161
|
-
v = dscontents[-1]
|
162
|
-
end
|
163
|
-
v['recipient'] = cv[1]
|
164
|
-
v['msexch'] = false
|
165
|
-
recipients += 1
|
137
|
+
# kijitora@example.com on 4/29/99 9:19:59 AM
|
138
|
+
if v['recipient']
|
139
|
+
# There are multiple recipient addresses in the message body.
|
140
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
141
|
+
v = dscontents[-1]
|
142
|
+
end
|
143
|
+
v['recipient'] = cv[1]
|
144
|
+
v['msexch'] = false
|
145
|
+
recipients += 1
|
166
146
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
147
|
+
elsif cv = e.match(/\A[ \t]+(MSEXCH:.+)\z/)
|
148
|
+
# MSEXCH:IMS:KIJITORA CAT:EXAMPLE:EXCHANGE 0 (000C05A6) Unknown Recipient
|
149
|
+
v['diagnosis'] ||= ''
|
150
|
+
v['diagnosis'] << cv[1]
|
151
|
+
else
|
152
|
+
next if v['msexch']
|
153
|
+
if v['diagnosis'].to_s.start_with?('MSEXCH:')
|
154
|
+
# Continued from MEEXCH in the previous line
|
155
|
+
v['msexch'] = true
|
156
|
+
v['diagnosis'] << ' ' << e
|
157
|
+
statuspart = true
|
171
158
|
else
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
v['msexch'] = true
|
176
|
-
v['diagnosis'] << ' ' << e
|
177
|
-
statuspart = true
|
178
|
-
else
|
179
|
-
# Error message in the body part
|
180
|
-
v['alterrors'] ||= ''
|
181
|
-
v['alterrors'] << ' ' << e
|
182
|
-
end
|
159
|
+
# Error message in the body part
|
160
|
+
v['alterrors'] ||= ''
|
161
|
+
v['alterrors'] << ' ' << e
|
183
162
|
end
|
184
|
-
|
185
|
-
|
186
|
-
|
163
|
+
end
|
164
|
+
else
|
165
|
+
# Your message
|
166
|
+
#
|
167
|
+
# To: shironeko@example.jp
|
168
|
+
# Subject: ...
|
169
|
+
# Sent: Thu, 29 Apr 2010 18:14:35 +0000
|
170
|
+
#
|
171
|
+
if cv = e.match(/\A[ \t]+To:[ \t]+(.+)\z/)
|
187
172
|
# To: shironeko@example.jp
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
if cv = e.match(/\A[ \t]+To:[ \t]+(.+)\z/)
|
192
|
-
# To: shironeko@example.jp
|
193
|
-
next unless connheader['to'].empty?
|
194
|
-
connheader['to'] = cv[1]
|
195
|
-
connvalues += 1
|
173
|
+
next unless connheader['to'].empty?
|
174
|
+
connheader['to'] = cv[1]
|
175
|
+
connvalues += 1
|
196
176
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
177
|
+
elsif cv = e.match(/\A[ \t]+Subject:[ \t]+(.+)\z/)
|
178
|
+
# Subject: ...
|
179
|
+
next unless connheader['subject'].empty?
|
180
|
+
connheader['subject'] = cv[1]
|
181
|
+
connvalues += 1
|
202
182
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
end
|
183
|
+
elsif cv = e.match(%r|\A[ \t]+Sent:[ \t]+([A-Z][a-z]{2},.+[-+]\d{4})\z|) ||
|
184
|
+
e.match(%r|\A[ \t]+Sent:[ \t]+(\d+[/]\d+[/]\d+[ \t]+\d+:\d+:\d+[ \t].+)|)
|
185
|
+
# Sent: Thu, 29 Apr 2010 18:14:35 +0000
|
186
|
+
# Sent: 4/29/99 9:19:59 AM
|
187
|
+
next unless connheader['date'].empty?
|
188
|
+
connheader['date'] = cv[1]
|
189
|
+
connvalues += 1
|
211
190
|
end
|
212
191
|
end
|
213
192
|
end
|
@@ -244,15 +223,14 @@ module Sisimai::Lhost
|
|
244
223
|
e.each_key { |a| e[a] ||= '' }
|
245
224
|
end
|
246
225
|
|
247
|
-
if
|
226
|
+
if emailsteak[1].empty?
|
248
227
|
# When original message does not included in the bounce message
|
249
|
-
|
250
|
-
|
251
|
-
|
228
|
+
emailsteak[1] << ('From: ' << connheader['to'] << "\n")
|
229
|
+
emailsteak[1] << ('Date: ' << connheader['date'] << "\n")
|
230
|
+
emailsteak[1] << ('Subject: ' << connheader['subject'] << "\n")
|
252
231
|
end
|
253
232
|
|
254
|
-
|
255
|
-
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
233
|
+
return { 'ds' => dscontents, 'rfc822' => emailsteak[1] }
|
256
234
|
end
|
257
235
|
|
258
236
|
end
|