sisimai 4.20.1 → 4.20.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.

Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +12 -2
  3. data/Changes +11 -1
  4. data/README-JA.md +135 -202
  5. data/README.md +128 -192
  6. data/fig/sisimai-architecture.png +0 -0
  7. data/lib/sisimai.rb +5 -3
  8. data/lib/sisimai/arf.rb +2 -2
  9. data/lib/sisimai/ced/us/amazonses.rb +5 -5
  10. data/lib/sisimai/ced/us/sendgrid.rb +4 -4
  11. data/lib/sisimai/data.rb +1 -8
  12. data/lib/sisimai/data/json.rb +1 -1
  13. data/lib/sisimai/datetime.rb +1 -1
  14. data/lib/sisimai/mail/maildir.rb +3 -3
  15. data/lib/sisimai/mda.rb +2 -2
  16. data/lib/sisimai/message.rb +7 -3
  17. data/lib/sisimai/message/email.rb +8 -2
  18. data/lib/sisimai/mime.rb +2 -2
  19. data/lib/sisimai/msp/de/einsundeins.rb +2 -2
  20. data/lib/sisimai/msp/de/gmx.rb +2 -2
  21. data/lib/sisimai/msp/jp/biglobe.rb +2 -2
  22. data/lib/sisimai/msp/jp/ezweb.rb +2 -2
  23. data/lib/sisimai/msp/jp/kddi.rb +3 -3
  24. data/lib/sisimai/msp/ru/mailru.rb +3 -3
  25. data/lib/sisimai/msp/ru/yandex.rb +2 -2
  26. data/lib/sisimai/msp/uk/messagelabs.rb +2 -2
  27. data/lib/sisimai/msp/us/amazonses.rb +4 -5
  28. data/lib/sisimai/msp/us/amazonworkmail.rb +2 -2
  29. data/lib/sisimai/msp/us/aol.rb +2 -2
  30. data/lib/sisimai/msp/us/bigfoot.rb +3 -3
  31. data/lib/sisimai/msp/us/facebook.rb +2 -2
  32. data/lib/sisimai/msp/us/google.rb +2 -2
  33. data/lib/sisimai/msp/us/office365.rb +2 -3
  34. data/lib/sisimai/msp/us/outlook.rb +2 -2
  35. data/lib/sisimai/msp/us/receivingses.rb +2 -2
  36. data/lib/sisimai/msp/us/sendgrid.rb +2 -2
  37. data/lib/sisimai/msp/us/verizon.rb +3 -3
  38. data/lib/sisimai/msp/us/yahoo.rb +2 -2
  39. data/lib/sisimai/msp/us/zoho.rb +2 -2
  40. data/lib/sisimai/mta/activehunter.rb +2 -2
  41. data/lib/sisimai/mta/apachejames.rb +3 -3
  42. data/lib/sisimai/mta/courier.rb +3 -3
  43. data/lib/sisimai/mta/domino.rb +2 -2
  44. data/lib/sisimai/mta/exchange2003.rb +4 -4
  45. data/lib/sisimai/mta/exchange2007.rb +2 -2
  46. data/lib/sisimai/mta/exim.rb +8 -4
  47. data/lib/sisimai/mta/imailserver.rb +3 -3
  48. data/lib/sisimai/mta/interscanmss.rb +3 -3
  49. data/lib/sisimai/mta/mailfoundry.rb +2 -2
  50. data/lib/sisimai/mta/mailmarshalsmtp.rb +2 -2
  51. data/lib/sisimai/mta/mcafee.rb +2 -2
  52. data/lib/sisimai/mta/messagingserver.rb +3 -3
  53. data/lib/sisimai/mta/mfilter.rb +2 -2
  54. data/lib/sisimai/mta/mxlogic.rb +3 -3
  55. data/lib/sisimai/mta/notes.rb +3 -3
  56. data/lib/sisimai/mta/opensmtpd.rb +2 -2
  57. data/lib/sisimai/mta/postfix.rb +3 -3
  58. data/lib/sisimai/mta/qmail.rb +3 -3
  59. data/lib/sisimai/mta/sendmail.rb +2 -2
  60. data/lib/sisimai/mta/surfcontrol.rb +2 -2
  61. data/lib/sisimai/mta/userdefined.rb +3 -3
  62. data/lib/sisimai/mta/v5sendmail.rb +3 -3
  63. data/lib/sisimai/mta/x1.rb +2 -2
  64. data/lib/sisimai/mta/x2.rb +2 -2
  65. data/lib/sisimai/mta/x3.rb +2 -2
  66. data/lib/sisimai/mta/x4.rb +3 -3
  67. data/lib/sisimai/mta/x5.rb +3 -3
  68. data/lib/sisimai/reason/rejected.rb +1 -0
  69. data/lib/sisimai/reason/securityerror.rb +7 -2
  70. data/lib/sisimai/reason/toomanyconn.rb +4 -0
  71. data/lib/sisimai/rfc3464.rb +3 -3
  72. data/lib/sisimai/rfc3834.rb +2 -2
  73. data/lib/sisimai/rfc5322.rb +4 -4
  74. data/lib/sisimai/rhost.rb +0 -1
  75. data/lib/sisimai/rhost/exchangeonline.rb +2 -2
  76. data/lib/sisimai/smtp.rb +4 -4
  77. data/lib/sisimai/smtp/error.rb +7 -12
  78. data/lib/sisimai/smtp/reply.rb +1 -1
  79. data/lib/sisimai/string.rb +7 -7
  80. data/lib/sisimai/version.rb +1 -1
  81. data/set-of-emails/maildir/bsd/rfc3834-06.eml +56 -0
  82. metadata +5 -3
@@ -69,7 +69,7 @@ module Sisimai
69
69
  v = nil
70
70
 
71
71
  hasdivided.each do |e|
72
- if readcursor == 0
72
+ if readcursor.zero?
73
73
  # Beginning of the bounce message or delivery status part
74
74
  if e =~ Re1[:begin]
75
75
  readcursor |= Indicators[:deliverystatus]
@@ -152,7 +152,7 @@ module Sisimai
152
152
  end
153
153
  end
154
154
 
155
- return nil if recipients == 0
155
+ return nil if recipients.zero?
156
156
  require 'sisimai/string'
157
157
  require 'sisimai/smtp/status'
158
158
 
@@ -73,7 +73,7 @@ module Sisimai
73
73
  havepassed << e
74
74
  p = havepassed[-2]
75
75
 
76
- if readcursor == 0
76
+ if readcursor.zero?
77
77
  # Beginning of the bounce message or delivery status part
78
78
  if e =~ Re1[:begin]
79
79
  readcursor |= Indicators[:deliverystatus]
@@ -174,7 +174,7 @@ module Sisimai
174
174
  end
175
175
  end
176
176
 
177
- return nil if recipients == 0
177
+ return nil if recipients.zero?
178
178
  require 'sisimai/string'
179
179
  require 'sisimai/smtp/status'
180
180
 
@@ -43,7 +43,7 @@ module Sisimai
43
43
  match = 0
44
44
  match += 1 if mhead['from'] =~ Re0[:from]
45
45
  match += 1 if mhead['received'].find { |a| a =~ Re0[:received] }
46
- return nil if match == 0
46
+ return nil if match.zero?
47
47
 
48
48
  require 'sisimai/address'
49
49
  dscontents = [Sisimai::MSP.DELIVERYSTATUS]
@@ -67,7 +67,7 @@ module Sisimai
67
67
  havepassed << e
68
68
  p = havepassed[-2]
69
69
 
70
- if readcursor == 0
70
+ if readcursor.zero?
71
71
  # Beginning of the bounce message or delivery status part
72
72
  if e =~ Re1[:begin]
73
73
  readcursor |= Indicators[:deliverystatus]
@@ -184,7 +184,7 @@ module Sisimai
184
184
  end
185
185
  end
186
186
  end
187
- return nil if recipients == 0
187
+ return nil if recipients.zero?
188
188
  require 'sisimai/string'
189
189
 
190
190
  dscontents.map do |e|
@@ -121,7 +121,7 @@ module Sisimai
121
121
  havepassed << e
122
122
  p = havepassed[-2]
123
123
 
124
- if readcursor == 0
124
+ if readcursor.zero?
125
125
  # Beginning of the bounce message or delivery status part
126
126
  if e =~ Re1[:begin]
127
127
  readcursor |= Indicators[:deliverystatus]
@@ -220,7 +220,7 @@ module Sisimai
220
220
  end
221
221
  end
222
222
  end
223
- return nil if recipients == 0
223
+ return nil if recipients.zero?
224
224
  require 'sisimai/string'
225
225
 
226
226
  dscontents.map do |e|
@@ -192,7 +192,7 @@ module Sisimai
192
192
  v = nil
193
193
 
194
194
  hasdivided.each do |e|
195
- if readcursor == 0
195
+ if readcursor.zero?
196
196
  # Beginning of the bounce message or delivery status part
197
197
  if e =~ Re1[:begin]
198
198
  readcursor |= Indicators[:deliverystatus]
@@ -259,7 +259,7 @@ module Sisimai
259
259
  end
260
260
  end
261
261
 
262
- return nil if recipients == 0
262
+ return nil if recipients.zero?
263
263
  require 'sisimai/string'
264
264
  require 'sisimai/smtp/status'
265
265
 
@@ -12,7 +12,6 @@ module Sisimai
12
12
  :'subject' => %r/Undeliverable:/,
13
13
  :'received' => %r/.+[.](?:outbound[.]protection|prod)[.]outlook[.]com\b/,
14
14
  :'message-id' => %r/.+[.](?:outbound[.]protection|prod)[.]outlook[.]com\b/,
15
-
16
15
  }
17
16
  Re1 = {
18
17
  :begin => %r{\A(?:
@@ -120,7 +119,7 @@ module Sisimai
120
119
  v = nil
121
120
 
122
121
  hasdivided.each do |e|
123
- if readcursor == 0
122
+ if readcursor.zero?
124
123
  # Beginning of the bounce message or delivery status part
125
124
  if e =~ Re1[:begin]
126
125
  readcursor |= Indicators[:deliverystatus]
@@ -226,7 +225,7 @@ module Sisimai
226
225
  end
227
226
  end
228
227
 
229
- return nil if recipients == 0
228
+ return nil if recipients.zero?
230
229
  require 'sisimai/string'
231
230
  require 'sisimai/smtp/status'
232
231
 
@@ -74,7 +74,7 @@ module Sisimai
74
74
  havepassed << e
75
75
  p = havepassed[-2]
76
76
 
77
- if readcursor == 0
77
+ if readcursor.zero?
78
78
  # Beginning of the bounce message or delivery status part
79
79
  if e =~ Re1[:begin]
80
80
  readcursor |= Indicators[:deliverystatus]
@@ -168,7 +168,7 @@ module Sisimai
168
168
  end
169
169
  end
170
170
  end
171
- return nil if recipients == 0
171
+ return nil if recipients.zero?
172
172
  require 'sisimai/string'
173
173
 
174
174
  dscontents.map do |e|
@@ -71,7 +71,7 @@ module Sisimai
71
71
  havepassed << e
72
72
  p = havepassed[-2]
73
73
 
74
- if readcursor == 0
74
+ if readcursor.zero?
75
75
  # Beginning of the bounce message or delivery status part
76
76
  if e =~ Re1[:begin]
77
77
  readcursor |= Indicators[:deliverystatus]
@@ -179,7 +179,7 @@ module Sisimai
179
179
  end
180
180
  end
181
181
 
182
- return nil if recipients == 0
182
+ return nil if recipients.zero?
183
183
  require 'sisimai/string'
184
184
  require 'sisimai/smtp/status'
185
185
 
@@ -67,7 +67,7 @@ module Sisimai
67
67
  havepassed << e
68
68
  p = havepassed[-2]
69
69
 
70
- if readcursor == 0
70
+ if readcursor.zero?
71
71
  # Beginning of the bounce message or delivery status part
72
72
  if e =~ Re1[:begin]
73
73
  readcursor |= Indicators[:deliverystatus]
@@ -180,7 +180,7 @@ module Sisimai
180
180
  end
181
181
  end
182
182
 
183
- return nil if recipients == 0
183
+ return nil if recipients.zero?
184
184
  require 'sisimai/string'
185
185
  require 'sisimai/smtp/status'
186
186
 
@@ -90,7 +90,7 @@ module Sisimai
90
90
  end
91
91
 
92
92
  hasdivided.each do |e|
93
- if readcursor == 0
93
+ if readcursor.zero?
94
94
  # Beginning of the bounce message or delivery status part
95
95
  if e =~ re1[:begin]
96
96
  readcursor |= Indicators[:deliverystatus]
@@ -169,7 +169,7 @@ module Sisimai
169
169
  end
170
170
 
171
171
  hasdivided.each do |e|
172
- if readcursor == 0
172
+ if readcursor.zero?
173
173
  # Beginning of the bounce message or delivery status part
174
174
  if e =~ re1[:begin]
175
175
  readcursor |= Indicators[:deliverystatus]
@@ -232,7 +232,7 @@ module Sisimai
232
232
  end
233
233
  end
234
234
 
235
- return nil if recipients == 0
235
+ return nil if recipients.zero?
236
236
 
237
237
  if !rfc822list.find { |a| a =~ /^From: / }
238
238
  # Set the value of "MAIL FROM:" or "From:"
@@ -53,7 +53,7 @@ module Sisimai
53
53
  v = nil
54
54
 
55
55
  hasdivided.each do |e|
56
- if readcursor == 0
56
+ if readcursor.zero?
57
57
  # Beginning of the bounce message or delivery status part
58
58
  if e =~ Re1[:begin]
59
59
  readcursor |= Indicators[:deliverystatus]
@@ -131,7 +131,7 @@ module Sisimai
131
131
  end
132
132
  end
133
133
  end
134
- return nil if recipients == 0
134
+ return nil if recipients.zero?
135
135
  require 'sisimai/string'
136
136
 
137
137
  dscontents.map do |e|
@@ -62,7 +62,7 @@ module Sisimai
62
62
  v = nil
63
63
 
64
64
  hasdivided.each do |e|
65
- if readcursor == 0
65
+ if readcursor.zero?
66
66
  # Beginning of the bounce message or delivery status part
67
67
  if e =~ Re1[:begin]
68
68
  readcursor |= Indicators[:deliverystatus]
@@ -143,7 +143,7 @@ module Sisimai
143
143
  end
144
144
  end
145
145
  end
146
- return nil if recipients == 0
146
+ return nil if recipients.zero?
147
147
  require 'sisimai/string'
148
148
 
149
149
  dscontents.map do |e|
@@ -50,7 +50,7 @@ module Sisimai
50
50
  v = nil
51
51
 
52
52
  hasdivided.each do |e|
53
- if readcursor == 0
53
+ if readcursor.zero?
54
54
  # Beginning of the bounce message or delivery status part
55
55
  if e =~ Re1[:begin]
56
56
  readcursor |= Indicators[:deliverystatus]
@@ -106,7 +106,7 @@ module Sisimai
106
106
  end
107
107
  end
108
108
  end
109
- return nil if recipients == 0
109
+ return nil if recipients.zero?
110
110
  require 'sisimai/string'
111
111
 
112
112
  dscontents.map do |e|
@@ -48,7 +48,7 @@ module Sisimai
48
48
  match += 1 if mhead['subject'] =~ Re0[:subject]
49
49
  match += 1 if mhead['message-id'] && mhead['message-id'] =~ Re0[:'message-id']
50
50
  match += 1 if mhead['received'].find { |a| a =~ Re0[:received] }
51
- return if match == 0
51
+ return if match.zero?
52
52
 
53
53
  dscontents = [Sisimai::MTA.DELIVERYSTATUS]
54
54
  hasdivided = mbody.split("\n")
@@ -62,7 +62,7 @@ module Sisimai
62
62
  v = nil
63
63
 
64
64
  hasdivided.each do |e|
65
- if readcursor == 0
65
+ if readcursor.zero?
66
66
  # Beginning of the bounce message or delivery status part
67
67
  if e =~ Re1[:begin]
68
68
  readcursor |= Indicators[:deliverystatus]
@@ -146,7 +146,7 @@ module Sisimai
146
146
  end
147
147
  end
148
148
  end
149
- return nil if recipients == 0
149
+ return nil if recipients.zero?
150
150
  require 'sisimai/string'
151
151
 
152
152
  unless rfc822list.find { |a| a =~ /^Subject:/ }
@@ -72,7 +72,7 @@ module Sisimai
72
72
  # Message-ID: <courier.4D025E3A.00001792@5jo.example.org>
73
73
  match += 1 if mhead['message-id'] =~ Re0[:'message-id']
74
74
  end
75
- return nil if match == 0
75
+ return nil if match.zero?
76
76
 
77
77
  dscontents = [Sisimai::MTA.DELIVERYSTATUS]
78
78
  hasdivided = mbody.split("\n")
@@ -95,7 +95,7 @@ module Sisimai
95
95
  havepassed << e
96
96
  p = havepassed[-2]
97
97
 
98
- if readcursor == 0
98
+ if readcursor.zero?
99
99
  # Beginning of the bounce message or delivery status part
100
100
  if e =~ Re1[:begin]
101
101
  readcursor |= Indicators[:deliverystatus]
@@ -228,7 +228,7 @@ module Sisimai
228
228
  end
229
229
  end
230
230
  end
231
- return nil if recipients == 0
231
+ return nil if recipients.zero?
232
232
  require 'sisimai/string'
233
233
 
234
234
  dscontents.map do |e|
@@ -64,7 +64,7 @@ module Sisimai
64
64
  hasdivided.each do |e|
65
65
  next if e.empty?
66
66
 
67
- if readcursor == 0
67
+ if readcursor.zero?
68
68
  # Beginning of the bounce message or delivery status part
69
69
  if e =~ Re1[:begin]
70
70
  readcursor |= Indicators[:deliverystatus]
@@ -140,7 +140,7 @@ module Sisimai
140
140
  end
141
141
  end
142
142
 
143
- return nil if recipients == 0
143
+ return nil if recipients.zero?
144
144
  require 'sisimai/string'
145
145
  require 'sisimai/smtp/status'
146
146
 
@@ -95,7 +95,7 @@ module Sisimai
95
95
  throw :EXCHANGE_OR_NOT if match > 0
96
96
  end
97
97
 
98
- throw :EXCHANGE_OR_NOT if mhead['received'].size == 0
98
+ throw :EXCHANGE_OR_NOT if mhead['received'].size.zero?
99
99
  mhead['received'].each do |e|
100
100
  # Received: by ***.**.** with Internet Mail Service (5.5.2657.72)
101
101
  next unless e =~ Re0[:'received']
@@ -105,7 +105,7 @@ module Sisimai
105
105
  break
106
106
  end
107
107
  end
108
- return nil if match == 0
108
+ return nil if match.zero?
109
109
 
110
110
  dscontents = [Sisimai::MTA.DELIVERYSTATUS]
111
111
  hasdivided = mbody.split("\n")
@@ -123,7 +123,7 @@ module Sisimai
123
123
  v = nil
124
124
 
125
125
  hasdivided.each do |e|
126
- if readcursor == 0
126
+ if readcursor.zero?
127
127
  # Beginning of the bounce message or delivery status part
128
128
  if e =~ Re1[:begin]
129
129
  readcursor |= Indicators[:deliverystatus]
@@ -233,7 +233,7 @@ module Sisimai
233
233
  end
234
234
  end
235
235
 
236
- return nil if recipients == 0
236
+ return nil if recipients.zero?
237
237
  require 'sisimai/string'
238
238
  require 'sisimai/smtp/status'
239
239
 
@@ -73,7 +73,7 @@ module Sisimai
73
73
  v = nil
74
74
 
75
75
  hasdivided.each do |e|
76
- if readcursor == 0
76
+ if readcursor.zero?
77
77
  # Beginning of the bounce message or delivery status part
78
78
  if e =~ Re1[:begin]
79
79
  readcursor |= Indicators[:deliverystatus]
@@ -152,7 +152,7 @@ module Sisimai
152
152
  end
153
153
  end
154
154
  end
155
- return nil if recipients == 0
155
+ return nil if recipients.zero?
156
156
 
157
157
  require 'sisimai/string'
158
158
  dscontents.map do |e|
@@ -181,7 +181,7 @@ module Sisimai
181
181
  hasdivided.each do |e|
182
182
  break if e =~ Re1[:endof]
183
183
 
184
- if readcursor == 0
184
+ if readcursor.zero?
185
185
  # Beginning of the bounce message or delivery status part
186
186
  if e =~ Re1[:begin]
187
187
  readcursor |= Indicators[:deliverystatus]
@@ -280,7 +280,7 @@ module Sisimai
280
280
 
281
281
  else
282
282
  # Error message ?
283
- if havepassed[:deliverystatus] == 0
283
+ if havepassed[:deliverystatus].zero?
284
284
  # Content-type: message/delivery-status
285
285
  havepassed[:deliverystatus] = 1 if e =~ Re1[:deliverystatus]
286
286
  v['alterrors'] ||= ''
@@ -324,7 +324,11 @@ module Sisimai
324
324
  if mhead['x-failed-recipients']
325
325
  # X-Failed-Recipients: kijitora@example.jp
326
326
  rcptinhead = mhead['x-failed-recipients'].split(',')
327
- rcptinhead.each { |a| a.lstrip!; a.rstrip!; }
327
+ rcptinhead.each do |a|
328
+ # Remove space characters
329
+ a.lstrip!
330
+ a.rstrip!
331
+ end
328
332
  recipients = rcptinhead.size
329
333
 
330
334
  rcptinhead.each do |e|
@@ -335,7 +339,7 @@ module Sisimai
335
339
  end
336
340
  end
337
341
  end
338
- return nil if recipients == 0
342
+ return nil if recipients.zero?
339
343
 
340
344
  if mhead['received'].size > 0
341
345
  # Get the name of local MTA
@@ -62,7 +62,7 @@ module Sisimai
62
62
  match = 0
63
63
  match += 1 if mhead['subject'] =~ Re0[:subject]
64
64
  match += 1 if mhead['x-mailer'] && mhead['x-mailer'] =~ Re0[:'x-mailer']
65
- return nil if match == 0
65
+ return nil if match.zero?
66
66
 
67
67
  dscontents = [Sisimai::MTA.DELIVERYSTATUS]
68
68
  hasdivided = mbody.split("\n")
@@ -73,7 +73,7 @@ module Sisimai
73
73
  v = nil
74
74
 
75
75
  hasdivided.each do |e|
76
- if readcursor == 0
76
+ if readcursor.zero?
77
77
  # Beginning of the bounce message or delivery status part
78
78
  if e =~ Re1[:begin]
79
79
  readcursor |= Indicators[:deliverystatus]
@@ -138,7 +138,7 @@ module Sisimai
138
138
  end
139
139
  end
140
140
  end
141
- return nil if recipients == 0
141
+ return nil if recipients.zero?
142
142
  require 'sisimai/string'
143
143
 
144
144
  dscontents.map do |e|