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.

Files changed (123) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.travis.yml +1 -0
  4. data/ANALYTICAL-PRECISION +2 -4
  5. data/CONTRIBUTING +4 -0
  6. data/ChangeLog.md +39 -0
  7. data/Developers.mk +1 -72
  8. data/Makefile +4 -0
  9. data/README-JA.md +3 -0
  10. data/README.md +5 -2
  11. data/lib/sisimai.rb +4 -3
  12. data/lib/sisimai/arf.rb +6 -6
  13. data/lib/sisimai/bite.rb +8 -3
  14. data/lib/sisimai/bite/email.rb +7 -50
  15. data/lib/sisimai/bite/json.rb +5 -25
  16. data/lib/sisimai/data.rb +1 -1
  17. data/lib/sisimai/lhost.rb +101 -0
  18. data/lib/sisimai/{bite/email → lhost}/activehunter.rb +10 -10
  19. data/lib/sisimai/{bite/email → lhost}/amavis.rb +9 -9
  20. data/lib/sisimai/lhost/amazonses.rb +403 -0
  21. data/lib/sisimai/{bite/email → lhost}/amazonworkmail.rb +9 -9
  22. data/lib/sisimai/{bite/email → lhost}/aol.rb +10 -10
  23. data/lib/sisimai/{bite/email → lhost}/apachejames.rb +10 -10
  24. data/lib/sisimai/{bite/email → lhost}/bigfoot.rb +9 -9
  25. data/lib/sisimai/{bite/email → lhost}/biglobe.rb +10 -10
  26. data/lib/sisimai/{bite/email → lhost}/courier.rb +10 -10
  27. data/lib/sisimai/{bite/email → lhost}/domino.rb +9 -9
  28. data/lib/sisimai/{bite/email → lhost}/einsundeins.rb +10 -10
  29. data/lib/sisimai/{bite/email → lhost}/exchange2003.rb +9 -9
  30. data/lib/sisimai/{bite/email → lhost}/exchange2007.rb +9 -9
  31. data/lib/sisimai/{bite/email → lhost}/exim.rb +10 -10
  32. data/lib/sisimai/{bite/email → lhost}/ezweb.rb +9 -9
  33. data/lib/sisimai/{bite/email → lhost}/facebook.rb +9 -9
  34. data/lib/sisimai/{bite/email → lhost}/fml.rb +10 -10
  35. data/lib/sisimai/{bite/email → lhost}/gmx.rb +10 -10
  36. data/lib/sisimai/{bite/email → lhost}/google.rb +14 -14
  37. data/lib/sisimai/{bite/email → lhost}/gsuite.rb +10 -10
  38. data/lib/sisimai/{bite/email → lhost}/imailserver.rb +10 -10
  39. data/lib/sisimai/{bite/email → lhost}/interscanmss.rb +9 -9
  40. data/lib/sisimai/{bite/email → lhost}/kddi.rb +10 -10
  41. data/lib/sisimai/{bite/email → lhost}/mailfoundry.rb +9 -9
  42. data/lib/sisimai/{bite/email → lhost}/mailmarshalsmtp.rb +9 -9
  43. data/lib/sisimai/{bite/email → lhost}/mailru.rb +11 -11
  44. data/lib/sisimai/{bite/email → lhost}/mcafee.rb +9 -9
  45. data/lib/sisimai/{bite/email → lhost}/messagelabs.rb +9 -9
  46. data/lib/sisimai/{bite/email → lhost}/messagingserver.rb +9 -9
  47. data/lib/sisimai/{bite/email → lhost}/mfilter.rb +9 -9
  48. data/lib/sisimai/{bite/email → lhost}/mxlogic.rb +10 -10
  49. data/lib/sisimai/{bite/email → lhost}/notes.rb +9 -9
  50. data/lib/sisimai/{bite/email → lhost}/office365.rb +10 -10
  51. data/lib/sisimai/{bite/email → lhost}/opensmtpd.rb +9 -9
  52. data/lib/sisimai/{bite/email → lhost}/outlook.rb +9 -9
  53. data/lib/sisimai/{bite/email → lhost}/postfix.rb +9 -9
  54. data/lib/sisimai/{bite/email → lhost}/qmail.rb +9 -9
  55. data/lib/sisimai/{bite/email → lhost}/receivingses.rb +11 -11
  56. data/lib/sisimai/{bite/email → lhost}/sendgrid.rb +120 -11
  57. data/lib/sisimai/{bite/email → lhost}/sendmail.rb +9 -9
  58. data/lib/sisimai/{bite/email → lhost}/surfcontrol.rb +9 -9
  59. data/lib/sisimai/{bite/email → lhost}/userdefined.rb +9 -9
  60. data/lib/sisimai/{bite/email → lhost}/v5sendmail.rb +10 -10
  61. data/lib/sisimai/{bite/email → lhost}/verizon.rb +11 -11
  62. data/lib/sisimai/{bite/email → lhost}/x1.rb +9 -9
  63. data/lib/sisimai/{bite/email → lhost}/x2.rb +9 -9
  64. data/lib/sisimai/{bite/email → lhost}/x3.rb +9 -9
  65. data/lib/sisimai/{bite/email → lhost}/x4.rb +10 -10
  66. data/lib/sisimai/{bite/email → lhost}/x5.rb +9 -9
  67. data/lib/sisimai/{bite/email → lhost}/yahoo.rb +9 -9
  68. data/lib/sisimai/{bite/email → lhost}/yandex.rb +10 -10
  69. data/lib/sisimai/{bite/email → lhost}/zoho.rb +10 -10
  70. data/lib/sisimai/mda.rb +1 -1
  71. data/lib/sisimai/message.rb +535 -28
  72. data/lib/sisimai/message/email.rb +3 -454
  73. data/lib/sisimai/message/json.rb +3 -177
  74. data/lib/sisimai/order.rb +238 -4
  75. data/lib/sisimai/order/email.rb +5 -190
  76. data/lib/sisimai/order/json.rb +3 -39
  77. data/lib/sisimai/reason.rb +1 -1
  78. data/lib/sisimai/reason/norelaying.rb +1 -1
  79. data/lib/sisimai/reason/userunknown.rb +1 -1
  80. data/lib/sisimai/reason/virusdetected.rb +1 -0
  81. data/lib/sisimai/rfc1894.rb +2 -2
  82. data/lib/sisimai/rfc3464.rb +13 -13
  83. data/lib/sisimai/rfc3834.rb +3 -3
  84. data/lib/sisimai/rfc5322.rb +1 -1
  85. data/lib/sisimai/rhost.rb +5 -4
  86. data/lib/sisimai/rhost/exchangeonline.rb +1 -1
  87. data/lib/sisimai/rhost/franceptt.rb +1 -1
  88. data/lib/sisimai/rhost/godaddy.rb +1 -1
  89. data/lib/sisimai/rhost/iua.rb +39 -0
  90. data/lib/sisimai/version.rb +1 -1
  91. data/set-of-emails/README.md +0 -1
  92. data/set-of-emails/maildir/bsd/email-gsuite-13.eml +261 -0
  93. data/set-of-emails/maildir/bsd/email-postfix-62.eml +105 -0
  94. data/set-of-emails/maildir/bsd/email-postfix-63.eml +85 -0
  95. data/set-of-emails/maildir/bsd/rhost-iua-01.eml +70 -0
  96. metadata +75 -94
  97. data/fig/sisimai-architecture.png +0 -0
  98. data/lib/sisimai/bite/email/amazonses.rb +0 -186
  99. data/lib/sisimai/bite/json/amazonses.rb +0 -242
  100. data/lib/sisimai/bite/json/sendgrid.rb +0 -123
  101. data/set-of-emails/jsonobj/json-amazonses-01.json +0 -1
  102. data/set-of-emails/jsonobj/json-amazonses-02.json +0 -11
  103. data/set-of-emails/jsonobj/json-amazonses-03.json +0 -1
  104. data/set-of-emails/jsonobj/json-amazonses-04.json +0 -1
  105. data/set-of-emails/jsonobj/json-amazonses-05.json +0 -1
  106. data/set-of-emails/jsonobj/json-amazonses-06.json +0 -1
  107. data/set-of-emails/jsonobj/json-sendgrid-01.json +0 -1
  108. data/set-of-emails/jsonobj/json-sendgrid-02.json +0 -1
  109. data/set-of-emails/jsonobj/json-sendgrid-03.json +0 -1
  110. data/set-of-emails/jsonobj/json-sendgrid-04.json +0 -1
  111. data/set-of-emails/jsonobj/json-sendgrid-05.json +0 -1
  112. data/set-of-emails/jsonobj/json-sendgrid-06.json +0 -1
  113. data/set-of-emails/jsonobj/json-sendgrid-07.json +0 -1
  114. data/set-of-emails/jsonobj/json-sendgrid-08.json +0 -1
  115. data/set-of-emails/jsonobj/json-sendgrid-09.json +0 -1
  116. data/set-of-emails/jsonobj/json-sendgrid-10.json +0 -1
  117. data/set-of-emails/jsonobj/json-sendgrid-11.json +0 -1
  118. data/set-of-emails/jsonobj/json-sendgrid-12.json +0 -1
  119. data/set-of-emails/jsonobj/json-sendgrid-13.json +0 -1
  120. data/set-of-emails/jsonobj/json-sendgrid-14.json +0 -1
  121. data/set-of-emails/jsonobj/json-sendgrid-15.json +0 -1
  122. data/set-of-emails/jsonobj/json-sendgrid-16.json +0 -1
  123. data/set-of-emails/jsonobj/json-sendgrid-17.json +0 -1
@@ -1,19 +1,19 @@
1
- module Sisimai::Bite::Email
2
- # Sisimai::Bite::Email::SendGrid parses a bounce email which created by
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/Bite/Email/SendGrid.pm
7
- require 'sisimai/bite/email'
6
+ # Imported from p5-Sisimail/lib/Sisimai/Lhost/SendGrid.pm
7
+ require 'sisimai/lhost'
8
8
 
9
- Indicators = Sisimai::Bite::Email.INDICATORS
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: http://sendgrid.com/'; end
16
- def smtpagent; return Sisimai::Bite.smtpagent(self); end
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 scan(mhead, mbody)
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::Bite.DELIVERYSTATUS]
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::Bite.DELIVERYSTATUS
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::Bite::Email
2
- # Sisimai::Bite::Email::Sendmail parses a bounce email which created by
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/Bite/Email/Sendmail.pm
7
- require 'sisimai/bite/email'
6
+ # Imported from p5-Sisimail/lib/Sisimai/Lhost/Sendmail.pm
7
+ require 'sisimai/lhost'
8
8
 
9
- Indicators = Sisimai::Bite::Email.INDICATORS
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::Bite.smtpagent(self); end
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 scan(mhead, mbody)
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::Bite.DELIVERYSTATUS]
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::Bite.DELIVERYSTATUS
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::Bite::Email
2
- # Sisimai::Bite::Email::SurfControl parses a bounce email which created by
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/Bite/Email/SurfControl.pm
8
- require 'sisimai/bite/email'
7
+ # Imported from p5-Sisimail/lib/Sisimai/Lhost/SurfControl.pm
8
+ require 'sisimai/lhost'
9
9
 
10
- Indicators = Sisimai::Bite::Email.INDICATORS
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::Bite.smtpagent(self); end
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 scan(mhead, mbody)
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::Bite.DELIVERYSTATUS]
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::Bite.DELIVERYSTATUS
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::Bite::Email
2
- # Sisimai::Bite::Email::UserDefined is an example module as a template to
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/Bite/Email/UserDefined.pm
7
- require 'sisimai/bite/email'
6
+ # Imported from p5-Sisimail/lib/Sisimai/Lhost/UserDefined.pm
7
+ require 'sisimai/lhost'
8
8
 
9
- Indicators = Sisimai::Bite::Email.INDICATORS
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::Bite.smtpagent(self); end
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 scan(mhead, mbody)
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/bite/email directory to implement codes.
51
- dscontents = [Sisimai::Bite.DELIVERYSTATUS]
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::Bite::Email
2
- # Sisimai::Bite::Email::V5sendmail parses a bounce email which created by
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/Bite/Email/V5sendmail.pm
8
- require 'sisimai/bite/email'
7
+ # Imported from p5-Sisimail/lib/Sisimai/Lhost/V5sendmail.pm
8
+ require 'sisimai/lhost'
9
9
 
10
- Indicators = Sisimai::Bite::Email.INDICATORS
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::Bite.smtpagent(self); end
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 scan(mhead, mbody)
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::Bite.DELIVERYSTATUS]
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::Bite.DELIVERYSTATUS
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::Bite::Email
2
- # Sisimai::Bite::Email::Verizon parses a bounce email which created by
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/Bite/Email/Verizon.pm
8
- require 'sisimai/bite/email'
9
- Indicators = Sisimai::Bite::Email.INDICATORS
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: http://www.verizonwireless.com'; end
12
- def smtpagent; return Sisimai::Bite.smtpagent(self); end
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 scan(mhead, mbody)
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::Bite.DELIVERYSTATUS]
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::Bite.DELIVERYSTATUS
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::Bite.DELIVERYSTATUS
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::Bite::Email
2
- # Sisimai::Bite::Email::X1 parses a bounce email which created by Unknown
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/Bite/Email/X1.pm
7
- require 'sisimai/bite/email'
6
+ # Imported from p5-Sisimail/lib/Sisimai/Lhost/X1.pm
7
+ require 'sisimai/lhost'
8
8
 
9
- Indicators = Sisimai::Bite::Email.INDICATORS
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::Bite.smtpagent(self); end
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 scan(mhead, mbody)
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::Bite.DELIVERYSTATUS]
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::Bite.DELIVERYSTATUS
85
+ dscontents << Sisimai::Lhost.DELIVERYSTATUS
86
86
  v = dscontents[-1]
87
87
  end
88
88
  v['recipient'] = cv[1]