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
@@ -1,8 +1,8 @@
|
|
1
1
|
module Sisimai::Bite::Email
|
2
|
+
# Sisimai::Bite::Email::Outlook parses a bounce email which created by
|
3
|
+
# Microsoft Outlook.com.
|
4
|
+
# Methods in the module are called from only Sisimai::Message.
|
2
5
|
module Outlook
|
3
|
-
# Sisimai::Bite::Email::Outlook parses a bounce email which created by
|
4
|
-
# Microsoft Outlook.com.
|
5
|
-
# Methods in the module are called from only Sisimai::Message.
|
6
6
|
class << self
|
7
7
|
# Imported from p5-Sisimail/lib/Sisimai/Bite/Email/US/Outlook.pm
|
8
8
|
require 'sisimai/bite/email'
|
@@ -11,17 +11,17 @@ module Sisimai::Bite::Email
|
|
11
11
|
:from => %r/postmaster[@]/,
|
12
12
|
:subject => %r/Delivery Status Notification/,
|
13
13
|
:received => %r/.+[.]hotmail[.]com\b/,
|
14
|
-
}
|
14
|
+
}.freeze
|
15
15
|
Re1 = {
|
16
16
|
:begin => %r/\AThis is an automatically generated Delivery Status Notification/,
|
17
17
|
:error => %r/\A[.]+ while talking to .+[:]\z/,
|
18
18
|
:rfc822 => %r|\AContent-Type: message/rfc822\z|,
|
19
19
|
:endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
|
20
|
-
}
|
20
|
+
}.freeze
|
21
21
|
ReFailure = {
|
22
22
|
hostunknown: %r/The mail could not be delivered to the recipient because the domain is not reachable/,
|
23
23
|
userunknown: %r/Requested action not taken: mailbox unavailable/,
|
24
|
-
}
|
24
|
+
}.freeze
|
25
25
|
Indicators = Sisimai::Bite::Email.INDICATORS
|
26
26
|
|
27
27
|
def description; return 'Microsoft Outlook.com: https://www.outlook.com/'; end
|
@@ -61,7 +61,7 @@ module Sisimai::Bite::Email
|
|
61
61
|
blanklines = 0 # (Integer) The number of blank lines
|
62
62
|
readcursor = 0 # (Integer) Points the current cursor position
|
63
63
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
64
|
-
connvalues = 0 # (Integer) Flag, 1 if all the value of
|
64
|
+
connvalues = 0 # (Integer) Flag, 1 if all the value of connheader have been set
|
65
65
|
connheader = {
|
66
66
|
'date' => '', # The value of Arrival-Date header
|
67
67
|
'lhost' => '', # The value of Reporting-MTA header
|
@@ -81,7 +81,7 @@ module Sisimai::Bite::Email
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
if readcursor & Indicators[:'message-rfc822']
|
84
|
+
if (readcursor & Indicators[:'message-rfc822']).zero?
|
85
85
|
# Beginning of the original message part
|
86
86
|
if e =~ Re1[:rfc822]
|
87
87
|
readcursor |= Indicators[:'message-rfc822']
|
@@ -100,7 +100,7 @@ module Sisimai::Bite::Email
|
|
100
100
|
|
101
101
|
else
|
102
102
|
# Before "message/rfc822"
|
103
|
-
next if readcursor & Indicators[:deliverystatus]
|
103
|
+
next if (readcursor & Indicators[:deliverystatus]).zero?
|
104
104
|
next if e.empty?
|
105
105
|
|
106
106
|
if connvalues == connheader.keys.size
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Sisimai::Bite::Email
|
2
|
+
# Sisimai::Bite::Email::Postfix parses a bounce email which created by
|
3
|
+
# Postfix. Methods in the module are called from only Sisimai::Message.
|
2
4
|
module Postfix
|
3
|
-
# Sisimai::Bite::Email::Postfix parses a bounce email which created by
|
4
|
-
# Postfix. Methods in the module are called from only Sisimai::Message.
|
5
5
|
class << self
|
6
6
|
# Imported from p5-Sisimail/lib/Sisimai/Bite/Email/Postfix.pm
|
7
7
|
require 'sisimai/bite/email'
|
@@ -10,7 +10,7 @@ module Sisimai::Bite::Email
|
|
10
10
|
Re0 = {
|
11
11
|
:from => %r/ [(]Mail Delivery System[)]\z/,
|
12
12
|
:subject => %r/\AUndelivered Mail Returned to Sender\z/,
|
13
|
-
}
|
13
|
+
}.freeze
|
14
14
|
Re1 = {
|
15
15
|
:begin => %r{\A(?>
|
16
16
|
[ ]+The[ ](?:
|
@@ -32,7 +32,7 @@ module Sisimai::Bite::Email
|
|
32
32
|
}x,
|
33
33
|
:rfc822 => %r!\AContent-Type:[ \t]*(?:message/rfc822|text/rfc822-headers)\z!x,
|
34
34
|
:endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
|
35
|
-
}
|
35
|
+
}.freeze
|
36
36
|
Indicators = Sisimai::Bite::Email.INDICATORS
|
37
37
|
|
38
38
|
def description; return 'Postfix'; end
|
@@ -64,7 +64,7 @@ module Sisimai::Bite::Email
|
|
64
64
|
readcursor = 0 # (Integer) Points the current cursor position
|
65
65
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
66
66
|
commandset = [] # (Array) ``in reply to * command'' list
|
67
|
-
connvalues = 0 # (Integer) Flag, 1 if all the value of
|
67
|
+
connvalues = 0 # (Integer) Flag, 1 if all the value of connheader have been set
|
68
68
|
connheader = {
|
69
69
|
'date' => '', # The value of Arrival-Date header
|
70
70
|
'lhost' => '', # The value of Received-From-MTA header
|
@@ -85,7 +85,7 @@ module Sisimai::Bite::Email
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
if readcursor & Indicators[:'message-rfc822']
|
88
|
+
if (readcursor & Indicators[:'message-rfc822']).zero?
|
89
89
|
# Beginning of the original message part
|
90
90
|
if e =~ Re1[:rfc822]
|
91
91
|
readcursor |= Indicators[:'message-rfc822']
|
@@ -104,7 +104,7 @@ module Sisimai::Bite::Email
|
|
104
104
|
|
105
105
|
else
|
106
106
|
# Before "message/rfc822"
|
107
|
-
next if readcursor & Indicators[:deliverystatus]
|
107
|
+
next if (readcursor & Indicators[:deliverystatus]).zero?
|
108
108
|
next if e.empty?
|
109
109
|
|
110
110
|
if connvalues == connheader.keys.size
|
@@ -203,7 +203,7 @@ module Sisimai::Bite::Email
|
|
203
203
|
elsif cv = e.match(/\A[Aa]rrival-[Dd]ate:[ ]*(.+)\z/)
|
204
204
|
# Arrival-Date: Wed, 29 Apr 2009 16:03:18 +0900
|
205
205
|
next if connheader['date'].size > 0
|
206
|
-
connheader['date'] = 1
|
206
|
+
connheader['date'] = cv[1]
|
207
207
|
connvalues += 1
|
208
208
|
|
209
209
|
elsif cv = e.match(/\A(X-Postfix-Sender):[ ]*rfc822;[ ]*(.+)\z/)
|
@@ -266,12 +266,12 @@ module Sisimai::Bite::Email
|
|
266
266
|
if e['diagnosis'] =~ /\A\d+\z/
|
267
267
|
e['diagnosis'] = anotherset['diagnosis']
|
268
268
|
else
|
269
|
-
# More detailed error message is in "
|
269
|
+
# More detailed error message is in "anotherset"
|
270
270
|
as = nil # status
|
271
271
|
ar = nil # replycode
|
272
272
|
|
273
273
|
if e['status'] == '' || e['status'] =~ /\A[45][.]0[.]0\z/
|
274
|
-
# Check the value of D.S.N. in
|
274
|
+
# Check the value of D.S.N. in anotherset
|
275
275
|
as = Sisimai::SMTP::Status.find(anotherset['diagnosis'])
|
276
276
|
if as.size > 0 && as[-3, 3] != '0.0'
|
277
277
|
# The D.S.N. is neither an empty nor *.0.0
|
@@ -280,7 +280,7 @@ module Sisimai::Bite::Email
|
|
280
280
|
end
|
281
281
|
|
282
282
|
if e['replycode'] == '' || e['replycode'] =~ /\A[45]00\z/
|
283
|
-
# Check the value of SMTP reply code in
|
283
|
+
# Check the value of SMTP reply code in anotherset
|
284
284
|
ar = Sisimai::SMTP::Reply.find(anotherset['diagnosis'])
|
285
285
|
if ar.size > 0 && ar[-2, 2].to_i != 0
|
286
286
|
# The SMTP reply code is neither an empty nor *00
|
@@ -288,8 +288,8 @@ module Sisimai::Bite::Email
|
|
288
288
|
end
|
289
289
|
end
|
290
290
|
|
291
|
-
if (
|
292
|
-
# Update the error message in
|
291
|
+
if (as || ar) && (anotherset['diagnosis'].size > e['diagnosis'].size)
|
292
|
+
# Update the error message in e['diagnosis']
|
293
293
|
e['diagnosis'] = anotherset['diagnosis']
|
294
294
|
end
|
295
295
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Sisimai::Bite::Email
|
2
|
+
# Sisimai::Bite::Email::Qmail parses a bounce email which created by qmail.
|
3
|
+
# Methods in the module are called from only Sisimai::Message.
|
2
4
|
module Qmail
|
3
|
-
# Sisimai::Bite::Email::Qmail parses a bounce email which created by qmail.
|
4
|
-
# Methods in the module are called from only Sisimai::Message.
|
5
5
|
class << self
|
6
6
|
# Imported from p5-Sisimail/lib/Sisimai/Bite/Email/qmail.pm
|
7
7
|
require 'sisimai/bite/email'
|
@@ -9,7 +9,7 @@ module Sisimai::Bite::Email
|
|
9
9
|
Re0 = {
|
10
10
|
:subject => %r/\Afailure notice/i,
|
11
11
|
:received => %r/\A[(]qmail[ ]+\d+[ ]+invoked[ ]+(?:for[ ]+bounce|from[ ]+network)[)]/,
|
12
|
-
}
|
12
|
+
}.freeze
|
13
13
|
# qmail-remote.c:248| if (code >= 500) {
|
14
14
|
# qmail-remote.c:249| out("h"); outhost(); out(" does not like recipient.\n");
|
15
15
|
# qmail-remote.c:265| if (code >= 500) quit("D"," failed on DATA command");
|
@@ -23,7 +23,7 @@ module Sisimai::Bite::Email
|
|
23
23
|
:error => %r/\ARemote host said:/,
|
24
24
|
:sorry => %r/\A[Ss]orry[,.][ ]/,
|
25
25
|
:endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
|
26
|
-
}
|
26
|
+
}.freeze
|
27
27
|
ReSMTP = {
|
28
28
|
# Error text regular expressions which defined in qmail-remote.c
|
29
29
|
# qmail-remote.c:225| if (smtpcode() != 220) quit("ZConnected to "," but greeting failed");
|
@@ -46,7 +46,7 @@ module Sisimai::Bite::Email
|
|
46
46
|
|(?:Error:)?.+[ ]failed[ ]after[ ]I[ ]sent[ ]the[ ]message[.]
|
47
47
|
)
|
48
48
|
}x,
|
49
|
-
}
|
49
|
+
}.freeze
|
50
50
|
# qmail-remote.c:261| if (!flagbother) quit("DGiving up on ","");
|
51
51
|
ReHost = %r{(?:
|
52
52
|
Giving[ ]up[ ]on[ ](.+[0-9a-zA-Z])[.]?\z
|
@@ -79,7 +79,7 @@ module Sisimai::Bite::Email
|
|
79
79
|
)
|
80
80
|
)
|
81
81
|
}x,
|
82
|
-
}
|
82
|
+
}.freeze
|
83
83
|
# userunknown + expired
|
84
84
|
ReOnHold = %r/\A[^ ]+ does not like recipient[.][ ]+.+this message has been in the queue too long[.]\z/
|
85
85
|
# qmail-remote-fallback.patch
|
@@ -114,7 +114,7 @@ module Sisimai::Bite::Email
|
|
114
114
|
)
|
115
115
|
}x,
|
116
116
|
systemfull: %r/Requested action not taken: mailbox unavailable [(]not enough free space[)]/,
|
117
|
-
}
|
117
|
+
}.freeze
|
118
118
|
# qmail-send.c:922| ... (&dline[c],"I'm not going to try again; this message has been in the queue too long.\n")) nomem();
|
119
119
|
ReDelayed = %r/this[ ]message[ ]has[ ]been[ ]in[ ]the[ ]queue[ ]too[ ]long[.]\z/x
|
120
120
|
Indicators = Sisimai::Bite::Email.INDICATORS
|
@@ -165,7 +165,7 @@ module Sisimai::Bite::Email
|
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
168
|
-
if readcursor & Indicators[:'message-rfc822']
|
168
|
+
if (readcursor & Indicators[:'message-rfc822']).zero?
|
169
169
|
# Beginning of the original message part
|
170
170
|
if e =~ Re1[:rfc822]
|
171
171
|
readcursor |= Indicators[:'message-rfc822']
|
@@ -184,7 +184,7 @@ module Sisimai::Bite::Email
|
|
184
184
|
|
185
185
|
else
|
186
186
|
# Before "message/rfc822"
|
187
|
-
next if readcursor & Indicators[:deliverystatus]
|
187
|
+
next if (readcursor & Indicators[:deliverystatus]).zero?
|
188
188
|
next if e.empty?
|
189
189
|
|
190
190
|
# <kijitora@example.jp>:
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Sisimai::Bite::Email
|
2
|
+
# Sisimai::Bite::Email::ReceivingSES parses a bounce email which created
|
3
|
+
# by Amazon Simple Email Service. Methods in the module are called from
|
4
|
+
# only Sisimai::Message.
|
2
5
|
module ReceivingSES
|
3
|
-
# Sisimai::Bite::Email::ReceivingSES parses a bounce email which created
|
4
|
-
# by Amazon Simple Email Service. Methods in the module are called from
|
5
|
-
# only Sisimai::Message.
|
6
6
|
class << self
|
7
7
|
# Imported from p5-Sisimail/lib/Sisimai/Bite/Email/ReceivingSES.pm
|
8
8
|
require 'sisimai/bite/email'
|
@@ -11,19 +11,19 @@ module Sisimai::Bite::Email
|
|
11
11
|
Re0 = {
|
12
12
|
:subject => %r/\ADelivery Status Notification [(]Failure[)]\z/,
|
13
13
|
:received => %r/.+[.]smtp-out[.].+[.]amazonses[.]com\b/,
|
14
|
-
}
|
14
|
+
}.freeze
|
15
15
|
Re1 = {
|
16
16
|
:begin => %r/\AThis message could not be delivered[.]\z/,
|
17
17
|
:rfc822 => %r|\Acontent-type: text/rfc822-headers\z|,
|
18
18
|
:endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
|
19
|
-
}
|
19
|
+
}.freeze
|
20
20
|
ReFailure = {
|
21
21
|
# The followings are error messages in Rule sets/*/Actions/Template
|
22
22
|
filtered: %r/Mailbox does not exist/,
|
23
23
|
mesgtoobig: %r/Message too large/,
|
24
24
|
mailboxfull: %r/Mailbox full/,
|
25
25
|
contenterror: %r/Message content rejected/,
|
26
|
-
}
|
26
|
+
}.freeze
|
27
27
|
Indicators = Sisimai::Bite::Email.INDICATORS
|
28
28
|
|
29
29
|
def description; return 'Amazon SES(Receiving): http://aws.amazon.com/ses/'; end
|
@@ -57,7 +57,7 @@ module Sisimai::Bite::Email
|
|
57
57
|
blanklines = 0 # (Integer) The number of blank lines
|
58
58
|
readcursor = 0 # (Integer) Points the current cursor position
|
59
59
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
60
|
-
connvalues = 0 # (Integer) Flag, 1 if all the value of
|
60
|
+
connvalues = 0 # (Integer) Flag, 1 if all the value of connheader have been set
|
61
61
|
connheader = {
|
62
62
|
'date' => '', # The value of Arrival-Date header
|
63
63
|
'lhost' => '', # The value of Reporting-MTA header
|
@@ -77,7 +77,7 @@ module Sisimai::Bite::Email
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
-
if readcursor & Indicators[:'message-rfc822']
|
80
|
+
if (readcursor & Indicators[:'message-rfc822']).zero?
|
81
81
|
# Beginning of the original message part
|
82
82
|
if e =~ Re1[:rfc822]
|
83
83
|
readcursor |= Indicators[:'message-rfc822']
|
@@ -96,7 +96,7 @@ module Sisimai::Bite::Email
|
|
96
96
|
|
97
97
|
else
|
98
98
|
# Before "message/rfc822"
|
99
|
-
next if readcursor & Indicators[:deliverystatus]
|
99
|
+
next if (readcursor & Indicators[:deliverystatus]).zero?
|
100
100
|
next if e.empty?
|
101
101
|
|
102
102
|
if connvalues == connheader.keys.size
|
@@ -1,22 +1,22 @@
|
|
1
1
|
module Sisimai::Bite::Email
|
2
|
+
# Sisimai::Bite::Email::SendGrid parses a bounce email which created by
|
3
|
+
# SendGrid. Methods in the module are called from only Sisimai::Message.
|
2
4
|
module SendGrid
|
3
|
-
# Sisimai::Bite::Email::SendGrid parses a bounce email which created by
|
4
|
-
# SendGrid. Methods in the module are called from only Sisimai::Message.
|
5
5
|
class << self
|
6
|
-
|
6
|
+
# Imported from p5-Sisimail/lib/Sisimai/Bite/Email/SendGrid.pm
|
7
7
|
require 'sisimai/bite/email'
|
8
8
|
|
9
9
|
Re0 = {
|
10
10
|
:'from' => %r/\AMAILER-DAEMON\z/,
|
11
11
|
:'return-path' => %r/\A[<]apps[@]sendgrid[.]net[>]\z/,
|
12
12
|
:'subject' => %r/\AUndelivered Mail Returned to Sender\z/,
|
13
|
-
}
|
13
|
+
}.freeze
|
14
14
|
Re1 = {
|
15
15
|
:begin => %r/\AThis is an automatically generated message from SendGrid[.]\z/,
|
16
16
|
:error => %r/\AIf you require assistance with this, please contact SendGrid support[.]\z/,
|
17
17
|
:rfc822 => %r|\AContent-Type: message/rfc822|,
|
18
18
|
:endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
|
19
|
-
}
|
19
|
+
}.freeze
|
20
20
|
Indicators = Sisimai::Bite::Email.INDICATORS
|
21
21
|
|
22
22
|
def description; return 'SendGrid: http://sendgrid.com/'; end
|
@@ -54,7 +54,7 @@ module Sisimai::Bite::Email
|
|
54
54
|
readcursor = 0 # (Integer) Points the current cursor position
|
55
55
|
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
56
56
|
commandtxt = '' # (String) SMTP Command name begin with the string '>>>'
|
57
|
-
connvalues = 0 # (Integer) Flag, 1 if all the value of
|
57
|
+
connvalues = 0 # (Integer) Flag, 1 if all the value of connheader have been set
|
58
58
|
connheader = {
|
59
59
|
'date' => '', # The value of Arrival-Date header
|
60
60
|
}
|
@@ -73,7 +73,7 @@ module Sisimai::Bite::Email
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
if readcursor & Indicators[:'message-rfc822']
|
76
|
+
if (readcursor & Indicators[:'message-rfc822']).zero?
|
77
77
|
# Beginning of the original message part
|
78
78
|
if e =~ Re1[:rfc822]
|
79
79
|
readcursor |= Indicators[:'message-rfc822']
|
@@ -92,7 +92,7 @@ module Sisimai::Bite::Email
|
|
92
92
|
|
93
93
|
else
|
94
94
|
# Before "message/rfc822"
|
95
|
-
next if readcursor & Indicators[:deliverystatus]
|
95
|
+
next if (readcursor & Indicators[:deliverystatus]).zero?
|
96
96
|
next if e.empty?
|
97
97
|
|
98
98
|
if connvalues == connheader.keys.size
|
@@ -188,7 +188,7 @@ module Sisimai::Bite::Email
|
|
188
188
|
# Get the value of SMTP status code as a pseudo D.S.N.
|
189
189
|
if cv = e['diagnosis'].match(/\b([45])\d\d[ \t]*/)
|
190
190
|
# 4xx or 5xx
|
191
|
-
e['status'] = sprintf(
|
191
|
+
e['status'] = sprintf('%d.0.0', cv[1])
|
192
192
|
end
|
193
193
|
|
194
194
|
if e['status'] =~ /[45][.]0[.]0/
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Sisimai::Bite::Email
|
2
|
+
# Sisimai::Bite::Email::Sendmail parses a bounce email which created by
|
3
|
+
# v8 Sendmail. Methods in the module are called from only Sisimai::Message.
|
2
4
|
module Sendmail
|
3
|
-
# Sisimai::Bite::Email::Sendmail parses a bounce email which created by
|
4
|
-
# v8 Sendmail. Methods in the module are called from only Sisimai::Message.
|
5
5
|
class << self
|
6
6
|
# Imported from p5-Sisimail/lib/Sisimai/Bite/Email/Sendmail.pm
|
7
7
|
require 'sisimai/bite/email'
|
@@ -9,7 +9,7 @@ module Sisimai::Bite::Email
|
|
9
9
|
Re0 = {
|
10
10
|
:from => %r/\AMail Delivery Subsystem/,
|
11
11
|
:subject => %r/(?:see transcript for details\z|\AWarning: )/,
|
12
|
-
}
|
12
|
+
}.freeze
|
13
13
|
# Error text regular expressions which defined in sendmail/savemail.c
|
14
14
|
# savemail.c:1040|if (printheader && !putline(" ----- Transcript of session follows -----\n",
|
15
15
|
# savemail.c:1041| mci))
|
@@ -20,7 +20,7 @@ module Sisimai::Bite::Email
|
|
20
20
|
:error => %r/\A[.]+ while talking to .+[:]\z/,
|
21
21
|
:rfc822 => %r{\AContent-Type:[ ]*(?:message/rfc822|text/rfc822-headers)\z},
|
22
22
|
:endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
|
23
|
-
}
|
23
|
+
}.freeze
|
24
24
|
Indicators = Sisimai::Bite::Email.INDICATORS
|
25
25
|
|
26
26
|
def description; return 'V8Sendmail: /usr/sbin/sendmail'; end
|
@@ -60,7 +60,7 @@ module Sisimai::Bite::Email
|
|
60
60
|
commandtxt = '' # (String) SMTP Command name begin with the string '>>>'
|
61
61
|
esmtpreply = '' # (String) Reply from remote server on SMTP session
|
62
62
|
sessionerr = false # (Boolean) Flag, "true" if it is SMTP session error
|
63
|
-
connvalues = 0 # (Integer) Flag, 1 if all the value of
|
63
|
+
connvalues = 0 # (Integer) Flag, 1 if all the value of connheader have been set
|
64
64
|
connheader = {
|
65
65
|
'date' => '', # The value of Arrival-Date header
|
66
66
|
'rhost' => '', # The value of Reporting-MTA header
|
@@ -81,7 +81,7 @@ module Sisimai::Bite::Email
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
if readcursor & Indicators[:'message-rfc822']
|
84
|
+
if (readcursor & Indicators[:'message-rfc822']).zero?
|
85
85
|
# Beginning of the original message part
|
86
86
|
if e =~ Re1[:rfc822]
|
87
87
|
readcursor |= Indicators[:'message-rfc822']
|
@@ -100,7 +100,7 @@ module Sisimai::Bite::Email
|
|
100
100
|
|
101
101
|
else
|
102
102
|
# Before "message/rfc822"
|
103
|
-
next if readcursor & Indicators[:deliverystatus]
|
103
|
+
next if (readcursor & Indicators[:deliverystatus]).zero?
|
104
104
|
next if e.empty?
|
105
105
|
|
106
106
|
if connvalues == connheader.keys.size
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Sisimai::Bite::Email
|
2
|
+
# Sisimai::Bite::Email::SurfControl parses a bounce email which created by
|
3
|
+
# WebSense SurfControl.
|
4
|
+
# Methods in the module are called from only Sisimai::Message.
|
2
5
|
module SurfControl
|
3
|
-
# Sisimai::Bite::Email::SurfControl parses a bounce email which created by
|
4
|
-
# WebSense SurfControl.
|
5
|
-
# Methods in the module are called from only Sisimai::Message.
|
6
6
|
class << self
|
7
7
|
# Imported from p5-Sisimail/lib/Sisimai/Bite/Email/SurfControl.pm
|
8
8
|
require 'sisimai/bite/email'
|
@@ -10,13 +10,13 @@ module Sisimai::Bite::Email
|
|
10
10
|
Re0 = {
|
11
11
|
:'from' => %r/ [(]Mail Delivery System[)]\z/,
|
12
12
|
:'x-mailer' => %r/\ASurfControl E-mail Filter\z/,
|
13
|
-
}
|
13
|
+
}.freeze
|
14
14
|
Re1 = {
|
15
15
|
:begin => %r/\AYour message could not be sent[.]\z/,
|
16
16
|
:error => %r/\AFailed to send to identified host,\z/,
|
17
17
|
:rfc822 => %r|\AContent-Type: message/rfc822\z|,
|
18
18
|
:endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
|
19
|
-
}
|
19
|
+
}.freeze
|
20
20
|
Indicators = Sisimai::Bite::Email.INDICATORS
|
21
21
|
|
22
22
|
def description; return 'WebSense SurfControl'; end
|
@@ -67,7 +67,7 @@ module Sisimai::Bite::Email
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
if readcursor & Indicators[:'message-rfc822']
|
70
|
+
if (readcursor & Indicators[:'message-rfc822']).zero?
|
71
71
|
# Beginning of the original message part
|
72
72
|
if e =~ Re1[:rfc822]
|
73
73
|
readcursor |= Indicators[:'message-rfc822']
|
@@ -86,7 +86,7 @@ module Sisimai::Bite::Email
|
|
86
86
|
|
87
87
|
else
|
88
88
|
# Before "message/rfc822"
|
89
|
-
next if readcursor & Indicators[:deliverystatus]
|
89
|
+
next if (readcursor & Indicators[:deliverystatus]).zero?
|
90
90
|
next if e.empty?
|
91
91
|
|
92
92
|
# Your message could not be sent.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Sisimai::Bite::Email
|
2
|
+
# Sisimai::Bite::Email::UserDefined is an example module as a template to
|
3
|
+
# implement your custom MTA module.
|
2
4
|
module UserDefined
|
3
|
-
# Sisimai::Bite::Email::UserDefined is an example module as a template to
|
4
|
-
# implement your custom MTA module.
|
5
5
|
class << self
|
6
6
|
# Imported from p5-Sisimail/lib/Sisimai/Bite/Email/UserDefined.pm
|
7
7
|
require 'sisimai/bite/email'
|
@@ -11,7 +11,7 @@ module Sisimai::Bite::Email
|
|
11
11
|
Re0 = {
|
12
12
|
:from => %r/\AMail Sysmet/,
|
13
13
|
:subject => %r/\AError Mail Report/,
|
14
|
-
}
|
14
|
+
}.freeze
|
15
15
|
|
16
16
|
# Re1 is delimiter set of these sections:
|
17
17
|
# begin: The first line of a bounce message to be parsed.
|
@@ -24,7 +24,7 @@ module Sisimai::Bite::Email
|
|
24
24
|
:error => %r/\A[.]+ while talking to .+[:]\z/,
|
25
25
|
:rfc822 => %r{\AContent-Type:[ ]*(?:message/rfc822|text/rfc822-headers)\z},
|
26
26
|
:endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
|
27
|
-
}
|
27
|
+
}.freeze
|
28
28
|
Indicators = Sisimai::Bite::Email.INDICATORS
|
29
29
|
|
30
30
|
def description; return 'Module description'; end
|
@@ -76,7 +76,7 @@ module Sisimai::Bite::Email
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
if readcursor & Indicators[:'message-rfc822']
|
79
|
+
if (readcursor & Indicators[:'message-rfc822']).zero?
|
80
80
|
# Beginning of the original message part
|
81
81
|
if e =~ Re1[:rfc822]
|
82
82
|
readcursor |= Indicators[:'message-rfc822']
|
@@ -95,7 +95,7 @@ module Sisimai::Bite::Email
|
|
95
95
|
|
96
96
|
else
|
97
97
|
# Before "message/rfc822"
|
98
|
-
next if readcursor & Indicators[:deliverystatus]
|
98
|
+
next if (readcursor & Indicators[:deliverystatus]).zero?
|
99
99
|
next if e.empty?
|
100
100
|
|
101
101
|
end
|
@@ -114,7 +114,7 @@ module Sisimai::Bite::Email
|
|
114
114
|
rfc822list << 'Subject: Nyaaan'
|
115
115
|
rfc822list << 'Message-Id: 000000000000@example.jp'
|
116
116
|
|
117
|
-
# 3. Return
|
117
|
+
# 3. Return nil when there is no recipient address which is failed to
|
118
118
|
# delivery in the bounce message
|
119
119
|
return nil if recipients.zero?
|
120
120
|
|