sisimai 4.25.3-java → 4.25.4-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/.gitignore +1 -0
- data/.travis.yml +1 -0
- data/ANALYTICAL-PRECISION +2 -4
- data/CONTRIBUTING +4 -0
- data/ChangeLog.md +39 -0
- data/Developers.mk +1 -72
- data/Makefile +4 -0
- data/README-JA.md +3 -0
- data/README.md +5 -2
- data/lib/sisimai.rb +4 -3
- data/lib/sisimai/arf.rb +6 -6
- data/lib/sisimai/bite.rb +8 -3
- data/lib/sisimai/bite/email.rb +7 -50
- data/lib/sisimai/bite/json.rb +5 -25
- data/lib/sisimai/data.rb +1 -1
- data/lib/sisimai/lhost.rb +101 -0
- data/lib/sisimai/{bite/email → lhost}/activehunter.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/amavis.rb +9 -9
- data/lib/sisimai/lhost/amazonses.rb +403 -0
- data/lib/sisimai/{bite/email → lhost}/amazonworkmail.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/aol.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/apachejames.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/bigfoot.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/biglobe.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/courier.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/domino.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/einsundeins.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/exchange2003.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/exchange2007.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/exim.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/ezweb.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/facebook.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/fml.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/gmx.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/google.rb +14 -14
- data/lib/sisimai/{bite/email → lhost}/gsuite.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/imailserver.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/interscanmss.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/kddi.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/mailfoundry.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/mailmarshalsmtp.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/mailru.rb +11 -11
- data/lib/sisimai/{bite/email → lhost}/mcafee.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/messagelabs.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/messagingserver.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/mfilter.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/mxlogic.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/notes.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/office365.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/opensmtpd.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/outlook.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/postfix.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/qmail.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/receivingses.rb +11 -11
- data/lib/sisimai/{bite/email → lhost}/sendgrid.rb +120 -11
- data/lib/sisimai/{bite/email → lhost}/sendmail.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/surfcontrol.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/userdefined.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/v5sendmail.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/verizon.rb +11 -11
- data/lib/sisimai/{bite/email → lhost}/x1.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/x2.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/x3.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/x4.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/x5.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/yahoo.rb +9 -9
- data/lib/sisimai/{bite/email → lhost}/yandex.rb +10 -10
- data/lib/sisimai/{bite/email → lhost}/zoho.rb +10 -10
- data/lib/sisimai/mda.rb +1 -1
- data/lib/sisimai/message.rb +535 -28
- data/lib/sisimai/message/email.rb +3 -454
- data/lib/sisimai/message/json.rb +3 -177
- data/lib/sisimai/order.rb +238 -4
- data/lib/sisimai/order/email.rb +5 -190
- data/lib/sisimai/order/json.rb +3 -39
- data/lib/sisimai/reason.rb +1 -1
- data/lib/sisimai/reason/norelaying.rb +1 -1
- data/lib/sisimai/reason/userunknown.rb +1 -1
- data/lib/sisimai/reason/virusdetected.rb +1 -0
- data/lib/sisimai/rfc1894.rb +2 -2
- data/lib/sisimai/rfc3464.rb +13 -13
- data/lib/sisimai/rfc3834.rb +3 -3
- data/lib/sisimai/rfc5322.rb +1 -1
- data/lib/sisimai/rhost.rb +5 -4
- data/lib/sisimai/rhost/exchangeonline.rb +1 -1
- data/lib/sisimai/rhost/franceptt.rb +1 -1
- data/lib/sisimai/rhost/godaddy.rb +1 -1
- data/lib/sisimai/rhost/iua.rb +39 -0
- data/lib/sisimai/version.rb +1 -1
- data/set-of-emails/README.md +0 -1
- data/set-of-emails/maildir/bsd/email-gsuite-13.eml +261 -0
- data/set-of-emails/maildir/bsd/email-postfix-62.eml +105 -0
- data/set-of-emails/maildir/bsd/email-postfix-63.eml +85 -0
- data/set-of-emails/maildir/bsd/rhost-iua-01.eml +70 -0
- metadata +75 -94
- data/fig/sisimai-architecture.png +0 -0
- data/lib/sisimai/bite/email/amazonses.rb +0 -186
- data/lib/sisimai/bite/json/amazonses.rb +0 -242
- data/lib/sisimai/bite/json/sendgrid.rb +0 -123
- data/set-of-emails/jsonobj/json-amazonses-01.json +0 -1
- data/set-of-emails/jsonobj/json-amazonses-02.json +0 -11
- data/set-of-emails/jsonobj/json-amazonses-03.json +0 -1
- data/set-of-emails/jsonobj/json-amazonses-04.json +0 -1
- data/set-of-emails/jsonobj/json-amazonses-05.json +0 -1
- data/set-of-emails/jsonobj/json-amazonses-06.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-01.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-02.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-03.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-04.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-05.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-06.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-07.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-08.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-09.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-10.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-11.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-12.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-13.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-14.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-15.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-16.json +0 -1
- data/set-of-emails/jsonobj/json-sendgrid-17.json +0 -1
@@ -1,19 +1,19 @@
|
|
1
|
-
module Sisimai::
|
2
|
-
# Sisimai::
|
1
|
+
module Sisimai::Lhost
|
2
|
+
# Sisimai::Lhost::SendGrid parses a bounce email which created by
|
3
3
|
# SendGrid. Methods in the module are called from only Sisimai::Message.
|
4
4
|
module SendGrid
|
5
5
|
class << self
|
6
|
-
# Imported from p5-Sisimail/lib/Sisimai/
|
7
|
-
require 'sisimai/
|
6
|
+
# Imported from p5-Sisimail/lib/Sisimai/Lhost/SendGrid.pm
|
7
|
+
require 'sisimai/lhost'
|
8
8
|
|
9
|
-
Indicators = Sisimai::
|
9
|
+
Indicators = Sisimai::Lhost.INDICATORS
|
10
10
|
StartingOf = {
|
11
11
|
message: ['This is an automatically generated message from SendGrid.'],
|
12
12
|
rfc822: ['Content-Type: message/rfc822'],
|
13
13
|
}.freeze
|
14
14
|
|
15
|
-
def description; return 'SendGrid:
|
16
|
-
def smtpagent; return Sisimai::
|
15
|
+
def description; return 'SendGrid: https://sendgrid.com/'; end
|
16
|
+
def smtpagent; return Sisimai::Lhost.smtpagent(self); end
|
17
17
|
|
18
18
|
# Return-Path: <apps@sendgrid.net>
|
19
19
|
# X-Mailer: MIME-tools 5.502 (Entity 5.502)
|
@@ -30,7 +30,7 @@ module Sisimai::Bite::Email
|
|
30
30
|
# @return [Hash, Nil] Bounce data list and message/rfc822
|
31
31
|
# part or nil if it failed to parse or
|
32
32
|
# the arguments are missing
|
33
|
-
def
|
33
|
+
def make(mhead, mbody)
|
34
34
|
# :'from' => %r/\AMAILER-DAEMON\z/,
|
35
35
|
return nil unless mhead['return-path']
|
36
36
|
return nil unless mhead['return-path'] == '<apps@sendgrid.net>'
|
@@ -40,7 +40,7 @@ module Sisimai::Bite::Email
|
|
40
40
|
fieldtable = Sisimai::RFC1894.FIELDTABLE
|
41
41
|
permessage = {} # (Hash) Store values of each Per-Message field
|
42
42
|
|
43
|
-
dscontents = [Sisimai::
|
43
|
+
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
44
44
|
hasdivided = mbody.split("\n")
|
45
45
|
havepassed = ['']
|
46
46
|
rfc822list = [] # (Array) Each line in message/rfc822 part string
|
@@ -95,7 +95,7 @@ module Sisimai::Bite::Email
|
|
95
95
|
# - Diagnostic-Code: 550 5.1.1 ... (No "diagnostic-type" sub field)
|
96
96
|
next unless cv = e.match(/\ADiagnostic-Code:[ ]*(.+)/)
|
97
97
|
v['diagnosis'] = cv[1]
|
98
|
-
next
|
98
|
+
next
|
99
99
|
end
|
100
100
|
|
101
101
|
if o[-1] == 'addr'
|
@@ -105,7 +105,7 @@ module Sisimai::Bite::Email
|
|
105
105
|
# Final-Recipient: rfc822; kijitora@example.jp
|
106
106
|
if v['recipient']
|
107
107
|
# There are multiple recipient addresses in the message body.
|
108
|
-
dscontents << Sisimai::
|
108
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
109
109
|
v = dscontents[-1]
|
110
110
|
end
|
111
111
|
v['recipient'] = o[2]
|
@@ -183,6 +183,115 @@ module Sisimai::Bite::Email
|
|
183
183
|
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
184
184
|
end
|
185
185
|
|
186
|
+
# @abstract Adapt SendGrid bounce object for Sisimai::Message format
|
187
|
+
# @param [Hash] argvs bounce object(JSON) retrieved from SendGrid API
|
188
|
+
# @return [Hash, Nil] Bounce data list and message/rfc822 part or
|
189
|
+
# nil if it failed to parse or the
|
190
|
+
# arguments are missing
|
191
|
+
# @since v4.20.0
|
192
|
+
# @until v4.25.5
|
193
|
+
def json(argvs)
|
194
|
+
return nil unless argvs.is_a? Hash
|
195
|
+
return nil if argvs.empty?
|
196
|
+
return nil unless argvs.key?('email')
|
197
|
+
return nil unless Sisimai::RFC5322.is_emailaddress(argvs['email'])
|
198
|
+
|
199
|
+
dscontents = nil
|
200
|
+
rfc822head = {}
|
201
|
+
v = nil
|
202
|
+
|
203
|
+
if argvs.key?('event')
|
204
|
+
# https://sendgrid.com/docs/API_Reference/Webhooks/event.html
|
205
|
+
# {
|
206
|
+
# 'tls' => 0,
|
207
|
+
# 'timestamp' => 1504555832,
|
208
|
+
# 'event' => 'bounce',
|
209
|
+
# 'email' => 'mailboxfull@example.jp',
|
210
|
+
# 'ip' => '192.0.2.22',
|
211
|
+
# 'sg_message_id' => '03_Wof6nRbqqzxRvLpZbfw.filter0017p3mdw1-11399-59ADB335-16.0',
|
212
|
+
# 'type' => 'blocked',
|
213
|
+
# 'sg_event_id' => 'S4wr46YHS0qr3BKhawTQjQ',
|
214
|
+
# 'reason' => '550 5.2.2 <mailboxfull@example.jp>... Mailbox Full ',
|
215
|
+
# 'smtp-id' => '<201709042010.v84KAQ5T032530@example.nyaan.jp>',
|
216
|
+
# 'status' => '5.2.2'
|
217
|
+
# },
|
218
|
+
return nil unless %w[bounce deferred delivered spamreport].include?(argvs['event'])
|
219
|
+
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
220
|
+
diagnostic = argvs['reason'] || ''
|
221
|
+
diagnostic = argvs['response'] || '' if diagnostic.empty?
|
222
|
+
timestamp0 = Sisimai::Time.parse(::Time.at(argvs['timestamp']).to_s)
|
223
|
+
v = dscontents[-1]
|
224
|
+
|
225
|
+
v['date'] = timestamp0.strftime("%a, %d %b %Y %T %z")
|
226
|
+
v['agent'] = self.smtpagent
|
227
|
+
v['lhost'] = argvs['ip'] || ''
|
228
|
+
v['status'] = argvs['status'] || nil
|
229
|
+
v['diagnosis'] = Sisimai::String.sweep(diagnostic)
|
230
|
+
v['recipient'] = argvs['email']
|
231
|
+
|
232
|
+
if argvs['event'] == 'delivered'
|
233
|
+
# "event": "delivered"
|
234
|
+
v['reason'] = 'delivered'
|
235
|
+
elsif argvs['event'] == 'spamreport'
|
236
|
+
# [
|
237
|
+
# {
|
238
|
+
# "email": "kijitora@example.com",
|
239
|
+
# "timestamp": 1504837383,
|
240
|
+
# "sg_message_id": "6_hrAeKvTDaB5ynBI2nbnQ.filter0002p3las1-27574-59B1FDA3-19.0",
|
241
|
+
# "sg_event_id": "o70uHqbMSXOaaoveMZIjjg",
|
242
|
+
# "event": "spamreport"
|
243
|
+
# }
|
244
|
+
# ]
|
245
|
+
v['reason'] = 'feedback'
|
246
|
+
v['feedbacktype'] = 'abuse'
|
247
|
+
end
|
248
|
+
v['status'] ||= Sisimai::SMTP::Status.find(v['diagnosis']) || ''
|
249
|
+
v['replycode'] ||= Sisimai::SMTP::Reply.find(v['diagnosis']) || ''
|
250
|
+
|
251
|
+
# Generate pseudo message/rfc822 part
|
252
|
+
rfc822head = {
|
253
|
+
'from' => Sisimai::Address.undisclosed('s'),
|
254
|
+
'message-id' => v['sg_message_id'],
|
255
|
+
}
|
256
|
+
else
|
257
|
+
# {
|
258
|
+
# "status": "4.0.0",
|
259
|
+
# "created": "2011-09-16 22:02:19",
|
260
|
+
# "reason": "Unable to resolve MX host sendgrid.ne",
|
261
|
+
# "email": "esting@sendgrid.ne"
|
262
|
+
# },
|
263
|
+
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
264
|
+
v = dscontents[-1]
|
265
|
+
|
266
|
+
v['recipient'] = argvs['email']
|
267
|
+
v['date'] = argvs['created'] || ''
|
268
|
+
|
269
|
+
statuscode = argvs['status'] || ''
|
270
|
+
diagnostic = Sisimai::String.sweep(argvs['reason']) || ''
|
271
|
+
|
272
|
+
if statuscode =~ /\A[245]\d\d\z/
|
273
|
+
# "status": "550"
|
274
|
+
v['replycode'] = statuscode
|
275
|
+
|
276
|
+
elsif statuscode =~ /\A[245][.]\d[.]\d+\z/
|
277
|
+
# "status": "5.1.1"
|
278
|
+
v['status'] = statuscode
|
279
|
+
end
|
280
|
+
|
281
|
+
v['status'] ||= Sisimai::SMTP::Status.find(diagnostic) || ''
|
282
|
+
v['replycode'] ||= Sisimai::SMTP::Reply.find(diagnostic) || ''
|
283
|
+
v['diagnosis'] = argvs['reason'] || ''
|
284
|
+
v['agent'] = self.smtpagent
|
285
|
+
|
286
|
+
# Generate pseudo message/rfc822 part
|
287
|
+
rfc822head = {
|
288
|
+
'from' => Sisimai::Address.undisclosed('s'),
|
289
|
+
'date' => v['date'],
|
290
|
+
}
|
291
|
+
end
|
292
|
+
return { 'ds' => dscontents, 'rfc822' => rfc822head }
|
293
|
+
end
|
294
|
+
|
186
295
|
end
|
187
296
|
end
|
188
297
|
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
module Sisimai::
|
2
|
-
# Sisimai::
|
1
|
+
module Sisimai::Lhost
|
2
|
+
# Sisimai::Lhost::Sendmail parses a bounce email which created by
|
3
3
|
# v8 Sendmail. Methods in the module are called from only Sisimai::Message.
|
4
4
|
module Sendmail
|
5
5
|
class << self
|
6
|
-
# Imported from p5-Sisimail/lib/Sisimai/
|
7
|
-
require 'sisimai/
|
6
|
+
# Imported from p5-Sisimail/lib/Sisimai/Lhost/Sendmail.pm
|
7
|
+
require 'sisimai/lhost'
|
8
8
|
|
9
|
-
Indicators = Sisimai::
|
9
|
+
Indicators = Sisimai::Lhost.INDICATORS
|
10
10
|
StartingOf = {
|
11
11
|
# Error text regular expressions which defined in sendmail/savemail.c
|
12
12
|
# savemail.c:1040|if (printheader && !putline(" ----- Transcript of session follows -----\n",
|
@@ -22,7 +22,7 @@ module Sisimai::Bite::Email
|
|
22
22
|
}.freeze
|
23
23
|
|
24
24
|
def description; return 'V8Sendmail: /usr/sbin/sendmail'; end
|
25
|
-
def smtpagent; return Sisimai::
|
25
|
+
def smtpagent; return Sisimai::Lhost.smtpagent(self); end
|
26
26
|
def headerlist; return []; end
|
27
27
|
|
28
28
|
# Parse bounce messages from Sendmail
|
@@ -36,7 +36,7 @@ module Sisimai::Bite::Email
|
|
36
36
|
# @return [Hash, Nil] Bounce data list and message/rfc822
|
37
37
|
# part or nil if it failed to parse or
|
38
38
|
# the arguments are missing
|
39
|
-
def
|
39
|
+
def make(mhead, mbody)
|
40
40
|
return nil unless mhead['subject'] =~ /(?:see transcript for details\z|\AWarning: )/
|
41
41
|
unless mhead['subject'].downcase =~ /\A[ \t]*fwd?:/
|
42
42
|
# Fwd: Returned mail: see transcript for details
|
@@ -48,7 +48,7 @@ module Sisimai::Bite::Email
|
|
48
48
|
fieldtable = Sisimai::RFC1894.FIELDTABLE
|
49
49
|
permessage = {} # (Hash) Store values of each Per-Message field
|
50
50
|
|
51
|
-
dscontents = [Sisimai::
|
51
|
+
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
52
52
|
hasdivided = mbody.split("\n")
|
53
53
|
havepassed = ['']
|
54
54
|
rfc822list = [] # (Array) Each line in message/rfc822 part string
|
@@ -107,7 +107,7 @@ module Sisimai::Bite::Email
|
|
107
107
|
# Final-Recipient: rfc822; kijitora@example.jp
|
108
108
|
if v['recipient']
|
109
109
|
# There are multiple recipient addresses in the message body.
|
110
|
-
dscontents << Sisimai::
|
110
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
111
111
|
v = dscontents[-1]
|
112
112
|
end
|
113
113
|
v['recipient'] = o[2]
|
@@ -1,20 +1,20 @@
|
|
1
|
-
module Sisimai::
|
2
|
-
# Sisimai::
|
1
|
+
module Sisimai::Lhost
|
2
|
+
# Sisimai::Lhost::SurfControl parses a bounce email which created by
|
3
3
|
# WebSense SurfControl.
|
4
4
|
# Methods in the module are called from only Sisimai::Message.
|
5
5
|
module SurfControl
|
6
6
|
class << self
|
7
|
-
# Imported from p5-Sisimail/lib/Sisimai/
|
8
|
-
require 'sisimai/
|
7
|
+
# Imported from p5-Sisimail/lib/Sisimai/Lhost/SurfControl.pm
|
8
|
+
require 'sisimai/lhost'
|
9
9
|
|
10
|
-
Indicators = Sisimai::
|
10
|
+
Indicators = Sisimai::Lhost.INDICATORS
|
11
11
|
StartingOf = {
|
12
12
|
message: ['Your message could not be sent.'],
|
13
13
|
rfc822: ['Content-Type: message/rfc822'],
|
14
14
|
}.freeze
|
15
15
|
|
16
16
|
def description; return 'WebSense SurfControl'; end
|
17
|
-
def smtpagent; return Sisimai::
|
17
|
+
def smtpagent; return Sisimai::Lhost.smtpagent(self); end
|
18
18
|
# X-SEF-ZeroHour-RefID: fgs=000000000
|
19
19
|
# X-SEF-Processed: 0_0_0_000__2010_04_29_23_34_45
|
20
20
|
# X-Mailer: SurfControl E-mail Filter
|
@@ -31,7 +31,7 @@ module Sisimai::Bite::Email
|
|
31
31
|
# @return [Hash, Nil] Bounce data list and message/rfc822
|
32
32
|
# part or nil if it failed to parse or
|
33
33
|
# the arguments are missing
|
34
|
-
def
|
34
|
+
def make(mhead, mbody)
|
35
35
|
# :'from' => %r/ [(]Mail Delivery System[)]\z/,
|
36
36
|
return nil unless mhead['x-sef-processed']
|
37
37
|
return nil unless mhead['x-mailer']
|
@@ -39,7 +39,7 @@ module Sisimai::Bite::Email
|
|
39
39
|
|
40
40
|
require 'sisimai/rfc1894'
|
41
41
|
fieldtable = Sisimai::RFC1894.FIELDTABLE
|
42
|
-
dscontents = [Sisimai::
|
42
|
+
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
43
43
|
hasdivided = mbody.split("\n")
|
44
44
|
havepassed = ['']
|
45
45
|
rfc822list = [] # (Array) Each line in message/rfc822 part string
|
@@ -97,7 +97,7 @@ module Sisimai::Bite::Email
|
|
97
97
|
# Addressed To: kijitora@example.com
|
98
98
|
if v['recipient']
|
99
99
|
# There are multiple recipient addresses in the message body.
|
100
|
-
dscontents << Sisimai::
|
100
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
101
101
|
v = dscontents[-1]
|
102
102
|
end
|
103
103
|
v['recipient'] = cv[1]
|
@@ -1,12 +1,12 @@
|
|
1
|
-
module Sisimai::
|
2
|
-
# Sisimai::
|
1
|
+
module Sisimai::Lhost
|
2
|
+
# Sisimai::Lhost::UserDefined is an example module as a template to
|
3
3
|
# implement your custom MTA module.
|
4
4
|
module UserDefined
|
5
5
|
class << self
|
6
|
-
# Imported from p5-Sisimail/lib/Sisimai/
|
7
|
-
require 'sisimai/
|
6
|
+
# Imported from p5-Sisimail/lib/Sisimai/Lhost/UserDefined.pm
|
7
|
+
require 'sisimai/lhost'
|
8
8
|
|
9
|
-
Indicators = Sisimai::
|
9
|
+
Indicators = Sisimai::Lhost.INDICATORS
|
10
10
|
MarkingsOf = {
|
11
11
|
# MarkingsOf is a delimiter set of these sections:
|
12
12
|
# message: The first line of a bounce message to be parsed.
|
@@ -20,7 +20,7 @@ module Sisimai::Bite::Email
|
|
20
20
|
}.freeze
|
21
21
|
|
22
22
|
def description; return 'Module description'; end
|
23
|
-
def smtpagent; return Sisimai::
|
23
|
+
def smtpagent; return Sisimai::Lhost.smtpagent(self); end
|
24
24
|
def headerlist; return %w[x-some-userdefined-header]; end
|
25
25
|
|
26
26
|
# @abstract Template for User-Defined MTA module
|
@@ -34,7 +34,7 @@ module Sisimai::Bite::Email
|
|
34
34
|
# @return [Hash, Nil] Bounce data list and message/rfc822
|
35
35
|
# part or nil if it failed to parse or
|
36
36
|
# the arguments are missing
|
37
|
-
def
|
37
|
+
def make(mhead, mbody)
|
38
38
|
# 1. Check some value in mhead using regular expression or "==" operator
|
39
39
|
# whether the bounce message should be parsed by this module or not.
|
40
40
|
# - Matched 1 or more values: Proceed to the step 2.
|
@@ -47,8 +47,8 @@ module Sisimai::Bite::Email
|
|
47
47
|
return nil unless match > 0
|
48
48
|
|
49
49
|
# 2. Parse message body(mbody) of the bounce message. See some modules
|
50
|
-
# in lib/sisimai/
|
51
|
-
dscontents = [Sisimai::
|
50
|
+
# in lib/sisimai/lhost directory to implement codes.
|
51
|
+
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
52
52
|
hasdivided = mbody.split("\n")
|
53
53
|
rfc822list = [] # (Array) Each line in message/rfc822 part string
|
54
54
|
blanklines = 0 # (Integer) The number of blank lines
|
@@ -1,14 +1,14 @@
|
|
1
|
-
module Sisimai::
|
2
|
-
# Sisimai::
|
1
|
+
module Sisimai::Lhost
|
2
|
+
# Sisimai::Lhost::V5sendmail parses a bounce email which created by
|
3
3
|
# Sendmail version 5.
|
4
4
|
# Methods in the module are called from only Sisimai::Message.
|
5
5
|
module V5sendmail
|
6
6
|
class << self
|
7
|
-
# Imported from p5-Sisimail/lib/Sisimai/
|
8
|
-
require 'sisimai/
|
7
|
+
# Imported from p5-Sisimail/lib/Sisimai/Lhost/V5sendmail.pm
|
8
|
+
require 'sisimai/lhost'
|
9
9
|
|
10
|
-
Indicators = Sisimai::
|
11
|
-
StartingOf = { message: ['----- Transcript of session follows -----'] }
|
10
|
+
Indicators = Sisimai::Lhost.INDICATORS
|
11
|
+
StartingOf = { message: ['----- Transcript of session follows -----'] }
|
12
12
|
MarkingsOf = {
|
13
13
|
# Error text regular expressions which defined in src/savemail.c
|
14
14
|
# savemail.c:485| (void) fflush(stdout);
|
@@ -35,7 +35,7 @@ module Sisimai::Bite::Email
|
|
35
35
|
}.freeze
|
36
36
|
|
37
37
|
def description; return 'Sendmail version 5'; end
|
38
|
-
def smtpagent; return Sisimai::
|
38
|
+
def smtpagent; return Sisimai::Lhost.smtpagent(self); end
|
39
39
|
def headerlist; return []; end
|
40
40
|
|
41
41
|
# Parse bounce messages from Sendmail version 5
|
@@ -49,11 +49,11 @@ module Sisimai::Bite::Email
|
|
49
49
|
# @return [Hash, Nil] Bounce data list and message/rfc822
|
50
50
|
# part or nil if it failed to parse or
|
51
51
|
# the arguments are missing
|
52
|
-
def
|
52
|
+
def make(mhead, mbody)
|
53
53
|
# :from => %r/\AMail Delivery Subsystem/,
|
54
54
|
return nil unless mhead['subject'] =~ /\AReturned mail: [A-Z]/
|
55
55
|
|
56
|
-
dscontents = [Sisimai::
|
56
|
+
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
57
57
|
hasdivided = mbody.split("\n")
|
58
58
|
rfc822list = [] # (Array) Each line in message/rfc822 part string
|
59
59
|
blanklines = 0 # (Integer) The number of blank lines
|
@@ -107,7 +107,7 @@ module Sisimai::Bite::Email
|
|
107
107
|
# 550 <kijitora@example.org>... User unknown
|
108
108
|
if v['recipient']
|
109
109
|
# There are multiple recipient addresses in the message body.
|
110
|
-
dscontents << Sisimai::
|
110
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
111
111
|
v = dscontents[-1]
|
112
112
|
end
|
113
113
|
v['recipient'] = cv[1]
|
@@ -1,15 +1,15 @@
|
|
1
|
-
module Sisimai::
|
2
|
-
# Sisimai::
|
1
|
+
module Sisimai::Lhost
|
2
|
+
# Sisimai::Lhost::Verizon parses a bounce email which created by
|
3
3
|
# Verizon Wireless.
|
4
4
|
# Methods in the module are called from only Sisimai::Message.
|
5
5
|
module Verizon
|
6
6
|
class << self
|
7
|
-
# Imported from p5-Sisimail/lib/Sisimai/
|
8
|
-
require 'sisimai/
|
9
|
-
Indicators = Sisimai::
|
7
|
+
# Imported from p5-Sisimail/lib/Sisimai/Lhost/Verizon.pm
|
8
|
+
require 'sisimai/lhost'
|
9
|
+
Indicators = Sisimai::Lhost.INDICATORS
|
10
10
|
|
11
|
-
def description; return 'Verizon Wireless:
|
12
|
-
def smtpagent; return Sisimai::
|
11
|
+
def description; return 'Verizon Wireless: https://www.verizonwireless.com'; end
|
12
|
+
def smtpagent; return Sisimai::Lhost.smtpagent(self); end
|
13
13
|
def headerlist; return []; end
|
14
14
|
|
15
15
|
# Parse bounce messages from Verizon
|
@@ -23,7 +23,7 @@ module Sisimai::Bite::Email
|
|
23
23
|
# @return [Hash, Nil] Bounce data list and message/rfc822
|
24
24
|
# part or nil if it failed to parse or
|
25
25
|
# the arguments are missing
|
26
|
-
def
|
26
|
+
def make(mhead, mbody)
|
27
27
|
match = -1
|
28
28
|
while true
|
29
29
|
# Check the value of "From" header
|
@@ -35,7 +35,7 @@ module Sisimai::Bite::Email
|
|
35
35
|
end
|
36
36
|
return nil if match < 0
|
37
37
|
|
38
|
-
dscontents = [Sisimai::
|
38
|
+
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
39
39
|
hasdivided = mbody.split("\n")
|
40
40
|
rfc822list = [] # (Array) Each line in message/rfc822 part string
|
41
41
|
blanklines = 0 # (Integer) The number of blank lines
|
@@ -101,7 +101,7 @@ module Sisimai::Bite::Email
|
|
101
101
|
if cv = e.match(/\A[ \t]+RCPT TO: (.*)\z/)
|
102
102
|
if v['recipient']
|
103
103
|
# There are multiple recipient addresses in the message body.
|
104
|
-
dscontents << Sisimai::
|
104
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
105
105
|
v = dscontents[-1]
|
106
106
|
end
|
107
107
|
|
@@ -170,7 +170,7 @@ module Sisimai::Bite::Email
|
|
170
170
|
if cv = e.match(/\ATo:[ \t]+(.*)\z/)
|
171
171
|
if v['recipient']
|
172
172
|
# There are multiple recipient addresses in the message body.
|
173
|
-
dscontents << Sisimai::
|
173
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
174
174
|
v = dscontents[-1]
|
175
175
|
end
|
176
176
|
v['recipient'] = Sisimai::Address.s3s4(cv[1])
|
@@ -1,19 +1,19 @@
|
|
1
|
-
module Sisimai::
|
2
|
-
# Sisimai::
|
1
|
+
module Sisimai::Lhost
|
2
|
+
# Sisimai::Lhost::X1 parses a bounce email which created by Unknown
|
3
3
|
# MTA #1. Methods in the module are called from only Sisimai::Message.
|
4
4
|
module X1
|
5
5
|
class << self
|
6
|
-
# Imported from p5-Sisimail/lib/Sisimai/
|
7
|
-
require 'sisimai/
|
6
|
+
# Imported from p5-Sisimail/lib/Sisimai/Lhost/X1.pm
|
7
|
+
require 'sisimai/lhost'
|
8
8
|
|
9
|
-
Indicators = Sisimai::
|
9
|
+
Indicators = Sisimai::Lhost.INDICATORS
|
10
10
|
MarkingsOf = {
|
11
11
|
message: %r/\AThe original message was received at (.+)\z/,
|
12
12
|
rfc822: %r/\AReceived: from \d+[.]\d+[.]\d+[.]\d/,
|
13
13
|
}.freeze
|
14
14
|
|
15
15
|
def description; return 'Unknown MTA #1'; end
|
16
|
-
def smtpagent; return Sisimai::
|
16
|
+
def smtpagent; return Sisimai::Lhost.smtpagent(self); end
|
17
17
|
def headerlist; return []; end
|
18
18
|
|
19
19
|
# Parse bounce messages from Unknown MTA #1
|
@@ -27,11 +27,11 @@ module Sisimai::Bite::Email
|
|
27
27
|
# @return [Hash, Nil] Bounce data list and message/rfc822
|
28
28
|
# part or nil if it failed to parse or
|
29
29
|
# the arguments are missing
|
30
|
-
def
|
30
|
+
def make(mhead, mbody)
|
31
31
|
return nil unless mhead['subject'].start_with?('Returned Mail: ')
|
32
32
|
return nil unless mhead['from'].start_with?('"Mail Deliver System" ')
|
33
33
|
|
34
|
-
dscontents = [Sisimai::
|
34
|
+
dscontents = [Sisimai::Lhost.DELIVERYSTATUS]
|
35
35
|
hasdivided = mbody.split("\n")
|
36
36
|
rfc822list = [] # (Array) Each line in message/rfc822 part string
|
37
37
|
blanklines = 0 # (Integer) The number of blank lines
|
@@ -82,7 +82,7 @@ module Sisimai::Bite::Email
|
|
82
82
|
# kijitora@example.co.jp [User unknown]
|
83
83
|
if v['recipient']
|
84
84
|
# There are multiple recipient addresses in the message body.
|
85
|
-
dscontents << Sisimai::
|
85
|
+
dscontents << Sisimai::Lhost.DELIVERYSTATUS
|
86
86
|
v = dscontents[-1]
|
87
87
|
end
|
88
88
|
v['recipient'] = cv[1]
|