mail 2.5.5 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +8 -9
  3. data/CONTRIBUTING.md +13 -0
  4. data/Dependencies.txt +0 -1
  5. data/Gemfile +7 -24
  6. data/README.md +36 -15
  7. data/Rakefile +10 -2
  8. data/VERSION +4 -0
  9. data/lib/mail.rb +1 -1
  10. data/lib/mail/body.rb +2 -2
  11. data/lib/mail/check_delivery_params.rb +10 -47
  12. data/lib/mail/core_extensions/string.rb +12 -2
  13. data/lib/mail/elements/address.rb +38 -82
  14. data/lib/mail/elements/address_list.rb +19 -42
  15. data/lib/mail/elements/content_disposition_element.rb +3 -7
  16. data/lib/mail/elements/content_location_element.rb +2 -6
  17. data/lib/mail/elements/content_transfer_encoding_element.rb +3 -10
  18. data/lib/mail/elements/content_type_element.rb +4 -8
  19. data/lib/mail/elements/date_time_element.rb +3 -7
  20. data/lib/mail/elements/envelope_from_element.rb +3 -11
  21. data/lib/mail/elements/message_ids_element.rb +1 -6
  22. data/lib/mail/elements/mime_version_element.rb +3 -7
  23. data/lib/mail/elements/phrase_list.rb +2 -7
  24. data/lib/mail/elements/received_element.rb +3 -7
  25. data/lib/mail/encodings.rb +0 -1
  26. data/lib/mail/envelope.rb +0 -5
  27. data/lib/mail/field.rb +53 -17
  28. data/lib/mail/field_list.rb +18 -18
  29. data/lib/mail/fields/common/common_address.rb +15 -20
  30. data/lib/mail/fields/common/common_date.rb +0 -7
  31. data/lib/mail/fields/common/common_field.rb +1 -1
  32. data/lib/mail/fields/content_transfer_encoding_field.rb +0 -6
  33. data/lib/mail/fields/resent_sender_field.rb +1 -1
  34. data/lib/mail/fields/sender_field.rb +1 -1
  35. data/lib/mail/fields/unstructured_field.rb +7 -1
  36. data/lib/mail/header.rb +8 -22
  37. data/lib/mail/mail.rb +12 -0
  38. data/lib/mail/matchers/has_sent_mail.rb +34 -1
  39. data/lib/mail/message.rb +18 -11
  40. data/lib/mail/multibyte/unicode.rb +1 -1
  41. data/lib/mail/network/delivery_methods/exim.rb +10 -6
  42. data/lib/mail/network/delivery_methods/file_delivery.rb +8 -4
  43. data/lib/mail/network/delivery_methods/sendmail.rb +7 -9
  44. data/lib/mail/network/delivery_methods/smtp.rb +5 -2
  45. data/lib/mail/network/delivery_methods/smtp_connection.rb +6 -2
  46. data/lib/mail/network/delivery_methods/test_mailer.rb +8 -5
  47. data/lib/mail/network/retriever_methods/imap.rb +18 -13
  48. data/lib/mail/parsers.rb +26 -0
  49. data/lib/mail/parsers/address_lists_parser.rb +132 -0
  50. data/lib/mail/parsers/content_disposition_parser.rb +67 -0
  51. data/lib/mail/parsers/content_location_parser.rb +35 -0
  52. data/lib/mail/parsers/content_transfer_encoding_parser.rb +33 -0
  53. data/lib/mail/parsers/content_type_parser.rb +64 -0
  54. data/lib/mail/parsers/date_time_parser.rb +36 -0
  55. data/lib/mail/parsers/envelope_from_parser.rb +45 -0
  56. data/lib/mail/parsers/message_ids_parser.rb +39 -0
  57. data/lib/mail/parsers/mime_version_parser.rb +41 -0
  58. data/lib/mail/parsers/phrase_lists_parser.rb +33 -0
  59. data/lib/mail/parsers/ragel.rb +17 -0
  60. data/lib/mail/parsers/ragel/common.rl +184 -0
  61. data/lib/mail/parsers/ragel/date_time.rl +30 -0
  62. data/lib/mail/parsers/ragel/parser_info.rb +61 -0
  63. data/lib/mail/parsers/ragel/ruby.rb +29 -0
  64. data/lib/mail/parsers/ragel/ruby/machines/address_lists_machine.rb +14864 -0
  65. data/lib/mail/parsers/ragel/ruby/machines/address_lists_machine.rb.rl +37 -0
  66. data/lib/mail/parsers/ragel/ruby/machines/content_disposition_machine.rb +751 -0
  67. data/lib/mail/parsers/ragel/ruby/machines/content_disposition_machine.rb.rl +37 -0
  68. data/lib/mail/parsers/ragel/ruby/machines/content_location_machine.rb +614 -0
  69. data/lib/mail/parsers/ragel/ruby/machines/content_location_machine.rb.rl +37 -0
  70. data/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb +447 -0
  71. data/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb.rl +37 -0
  72. data/lib/mail/parsers/ragel/ruby/machines/content_type_machine.rb +825 -0
  73. data/lib/mail/parsers/ragel/ruby/machines/content_type_machine.rb.rl +37 -0
  74. data/lib/mail/parsers/ragel/ruby/machines/date_time_machine.rb +817 -0
  75. data/lib/mail/parsers/ragel/ruby/machines/date_time_machine.rb.rl +37 -0
  76. data/lib/mail/parsers/ragel/ruby/machines/envelope_from_machine.rb +2129 -0
  77. data/lib/mail/parsers/ragel/ruby/machines/envelope_from_machine.rb.rl +37 -0
  78. data/lib/mail/parsers/ragel/ruby/machines/message_ids_machine.rb +1570 -0
  79. data/lib/mail/parsers/ragel/ruby/machines/message_ids_machine.rb.rl +37 -0
  80. data/lib/mail/parsers/ragel/ruby/machines/mime_version_machine.rb +440 -0
  81. data/lib/mail/parsers/ragel/ruby/machines/mime_version_machine.rb.rl +37 -0
  82. data/lib/mail/parsers/ragel/ruby/machines/phrase_lists_machine.rb +564 -0
  83. data/lib/mail/parsers/ragel/ruby/machines/phrase_lists_machine.rb.rl +37 -0
  84. data/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl +51 -0
  85. data/lib/mail/parsers/ragel/ruby/machines/received_machine.rb +5144 -0
  86. data/lib/mail/parsers/ragel/ruby/machines/received_machine.rb.rl +37 -0
  87. data/lib/mail/parsers/ragel/ruby/parser.rb.rl.erb +37 -0
  88. data/lib/mail/parsers/received_parser.rb +47 -0
  89. data/lib/mail/parts_list.rb +4 -2
  90. data/lib/mail/patterns.rb +3 -1
  91. data/lib/mail/utilities.rb +3 -1
  92. data/lib/mail/version.rb +1 -1
  93. data/lib/mail/version_specific/ruby_1_8.rb +1 -1
  94. data/lib/mail/version_specific/ruby_1_9.rb +13 -1
  95. metadata +55 -51
  96. data/lib/VERSION +0 -4
  97. data/lib/load_parsers.rb +0 -35
  98. data/lib/mail/parsers/address_lists.rb +0 -64
  99. data/lib/mail/parsers/address_lists.treetop +0 -19
  100. data/lib/mail/parsers/content_disposition.rb +0 -535
  101. data/lib/mail/parsers/content_disposition.treetop +0 -46
  102. data/lib/mail/parsers/content_location.rb +0 -139
  103. data/lib/mail/parsers/content_location.treetop +0 -20
  104. data/lib/mail/parsers/content_transfer_encoding.rb +0 -201
  105. data/lib/mail/parsers/content_transfer_encoding.treetop +0 -18
  106. data/lib/mail/parsers/content_type.rb +0 -971
  107. data/lib/mail/parsers/content_type.treetop +0 -68
  108. data/lib/mail/parsers/date_time.rb +0 -114
  109. data/lib/mail/parsers/date_time.treetop +0 -11
  110. data/lib/mail/parsers/envelope_from.rb +0 -194
  111. data/lib/mail/parsers/envelope_from.treetop +0 -32
  112. data/lib/mail/parsers/message_ids.rb +0 -45
  113. data/lib/mail/parsers/message_ids.treetop +0 -15
  114. data/lib/mail/parsers/mime_version.rb +0 -144
  115. data/lib/mail/parsers/mime_version.treetop +0 -19
  116. data/lib/mail/parsers/phrase_lists.rb +0 -45
  117. data/lib/mail/parsers/phrase_lists.treetop +0 -15
  118. data/lib/mail/parsers/received.rb +0 -71
  119. data/lib/mail/parsers/received.treetop +0 -11
  120. data/lib/mail/parsers/rfc2045.rb +0 -421
  121. data/lib/mail/parsers/rfc2045.treetop +0 -35
  122. data/lib/mail/parsers/rfc2822.rb +0 -5397
  123. data/lib/mail/parsers/rfc2822.treetop +0 -408
  124. data/lib/mail/parsers/rfc2822_obsolete.rb +0 -3768
  125. data/lib/mail/parsers/rfc2822_obsolete.treetop +0 -241
  126. data/lib/tasks/corpus.rake +0 -125
  127. data/lib/tasks/treetop.rake +0 -10
@@ -1,19 +0,0 @@
1
- module Mail
2
- grammar AddressLists
3
-
4
- include RFC2822
5
-
6
- rule primary_address
7
- address_list {
8
- def addresses
9
- ([first_addr] + other_addr.elements.map { |o| o.addr_value }).reject { |e| e.empty? }
10
- end
11
- } / obs_addr_list {
12
- def addresses
13
- [first_addr] + other_addr.elements.map { |o| o.addr_value }
14
- end
15
- }
16
- end
17
-
18
- end
19
- end
@@ -1,535 +0,0 @@
1
- # Autogenerated from a Treetop grammar. Edits may be lost.
2
-
3
-
4
- module Mail
5
- module ContentDisposition
6
- include Treetop::Runtime
7
-
8
- def root
9
- @root ||= :content_disposition
10
- end
11
-
12
- include RFC2822
13
-
14
- include RFC2045
15
-
16
- module ContentDisposition0
17
- def CFWS1
18
- elements[0]
19
- end
20
-
21
- def parameter
22
- elements[2]
23
- end
24
-
25
- def CFWS2
26
- elements[3]
27
- end
28
- end
29
-
30
- module ContentDisposition1
31
- def disposition_type
32
- elements[0]
33
- end
34
-
35
- def param_hashes
36
- elements[1]
37
- end
38
- end
39
-
40
- module ContentDisposition2
41
- def parameters
42
- param_hashes.elements.map do |param|
43
- param.parameter.param_hash
44
- end
45
- end
46
- end
47
-
48
- def _nt_content_disposition
49
- start_index = index
50
- if node_cache[:content_disposition].has_key?(index)
51
- cached = node_cache[:content_disposition][index]
52
- if cached
53
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
54
- @index = cached.interval.end
55
- end
56
- return cached
57
- end
58
-
59
- i0, s0 = index, []
60
- r1 = _nt_disposition_type
61
- s0 << r1
62
- if r1
63
- s2, i2 = [], index
64
- loop do
65
- i3, s3 = index, []
66
- r4 = _nt_CFWS
67
- s3 << r4
68
- if r4
69
- if has_terminal?(";", false, index)
70
- r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
71
- @index += 1
72
- else
73
- terminal_parse_failure(";")
74
- r5 = nil
75
- end
76
- s3 << r5
77
- if r5
78
- r6 = _nt_parameter
79
- s3 << r6
80
- if r6
81
- r7 = _nt_CFWS
82
- s3 << r7
83
- end
84
- end
85
- end
86
- if s3.last
87
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
88
- r3.extend(ContentDisposition0)
89
- else
90
- @index = i3
91
- r3 = nil
92
- end
93
- if r3
94
- s2 << r3
95
- else
96
- break
97
- end
98
- end
99
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
100
- s0 << r2
101
- end
102
- if s0.last
103
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
104
- r0.extend(ContentDisposition1)
105
- r0.extend(ContentDisposition2)
106
- else
107
- @index = i0
108
- r0 = nil
109
- end
110
-
111
- node_cache[:content_disposition][start_index] = r0
112
-
113
- r0
114
- end
115
-
116
- module DispositionType0
117
- end
118
-
119
- module DispositionType1
120
- end
121
-
122
- def _nt_disposition_type
123
- start_index = index
124
- if node_cache[:disposition_type].has_key?(index)
125
- cached = node_cache[:disposition_type][index]
126
- if cached
127
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
128
- @index = cached.interval.end
129
- end
130
- return cached
131
- end
132
-
133
- i0 = index
134
- i1, s1 = index, []
135
- if has_terminal?('\G[iI]', true, index)
136
- r2 = true
137
- @index += 1
138
- else
139
- r2 = nil
140
- end
141
- s1 << r2
142
- if r2
143
- if has_terminal?('\G[nN]', true, index)
144
- r3 = true
145
- @index += 1
146
- else
147
- r3 = nil
148
- end
149
- s1 << r3
150
- if r3
151
- if has_terminal?('\G[lL]', true, index)
152
- r4 = true
153
- @index += 1
154
- else
155
- r4 = nil
156
- end
157
- s1 << r4
158
- if r4
159
- if has_terminal?('\G[iI]', true, index)
160
- r5 = true
161
- @index += 1
162
- else
163
- r5 = nil
164
- end
165
- s1 << r5
166
- if r5
167
- if has_terminal?('\G[nN]', true, index)
168
- r6 = true
169
- @index += 1
170
- else
171
- r6 = nil
172
- end
173
- s1 << r6
174
- if r6
175
- if has_terminal?('\G[eE]', true, index)
176
- r7 = true
177
- @index += 1
178
- else
179
- r7 = nil
180
- end
181
- s1 << r7
182
- end
183
- end
184
- end
185
- end
186
- end
187
- if s1.last
188
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
189
- r1.extend(DispositionType0)
190
- else
191
- @index = i1
192
- r1 = nil
193
- end
194
- if r1
195
- r0 = r1
196
- else
197
- i8, s8 = index, []
198
- if has_terminal?('\G[aA]', true, index)
199
- r9 = true
200
- @index += 1
201
- else
202
- r9 = nil
203
- end
204
- s8 << r9
205
- if r9
206
- if has_terminal?('\G[tT]', true, index)
207
- r10 = true
208
- @index += 1
209
- else
210
- r10 = nil
211
- end
212
- s8 << r10
213
- if r10
214
- if has_terminal?('\G[tT]', true, index)
215
- r11 = true
216
- @index += 1
217
- else
218
- r11 = nil
219
- end
220
- s8 << r11
221
- if r11
222
- if has_terminal?('\G[aA]', true, index)
223
- r12 = true
224
- @index += 1
225
- else
226
- r12 = nil
227
- end
228
- s8 << r12
229
- if r12
230
- if has_terminal?('\G[cC]', true, index)
231
- r13 = true
232
- @index += 1
233
- else
234
- r13 = nil
235
- end
236
- s8 << r13
237
- if r13
238
- if has_terminal?('\G[hH]', true, index)
239
- r14 = true
240
- @index += 1
241
- else
242
- r14 = nil
243
- end
244
- s8 << r14
245
- if r14
246
- if has_terminal?('\G[mM]', true, index)
247
- r15 = true
248
- @index += 1
249
- else
250
- r15 = nil
251
- end
252
- s8 << r15
253
- if r15
254
- if has_terminal?('\G[eE]', true, index)
255
- r16 = true
256
- @index += 1
257
- else
258
- r16 = nil
259
- end
260
- s8 << r16
261
- if r16
262
- if has_terminal?('\G[nN]', true, index)
263
- r17 = true
264
- @index += 1
265
- else
266
- r17 = nil
267
- end
268
- s8 << r17
269
- if r17
270
- if has_terminal?('\G[tT]', true, index)
271
- r18 = true
272
- @index += 1
273
- else
274
- r18 = nil
275
- end
276
- s8 << r18
277
- end
278
- end
279
- end
280
- end
281
- end
282
- end
283
- end
284
- end
285
- end
286
- if s8.last
287
- r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
288
- r8.extend(DispositionType1)
289
- else
290
- @index = i8
291
- r8 = nil
292
- end
293
- if r8
294
- r0 = r8
295
- else
296
- r19 = _nt_extension_token
297
- if r19
298
- r0 = r19
299
- else
300
- if has_terminal?('', false, index)
301
- r20 = instantiate_node(SyntaxNode,input, index...(index + 0))
302
- @index += 0
303
- else
304
- terminal_parse_failure('')
305
- r20 = nil
306
- end
307
- if r20
308
- r0 = r20
309
- else
310
- @index = i0
311
- r0 = nil
312
- end
313
- end
314
- end
315
- end
316
-
317
- node_cache[:disposition_type][start_index] = r0
318
-
319
- r0
320
- end
321
-
322
- def _nt_extension_token
323
- start_index = index
324
- if node_cache[:extension_token].has_key?(index)
325
- cached = node_cache[:extension_token][index]
326
- if cached
327
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
328
- @index = cached.interval.end
329
- end
330
- return cached
331
- end
332
-
333
- i0 = index
334
- r1 = _nt_ietf_token
335
- if r1
336
- r0 = r1
337
- else
338
- r2 = _nt_custom_x_token
339
- if r2
340
- r0 = r2
341
- else
342
- @index = i0
343
- r0 = nil
344
- end
345
- end
346
-
347
- node_cache[:extension_token][start_index] = r0
348
-
349
- r0
350
- end
351
-
352
- module Parameter0
353
- def attr
354
- elements[1]
355
- end
356
-
357
- def val
358
- elements[3]
359
- end
360
-
361
- end
362
-
363
- module Parameter1
364
- def param_hash
365
- {attr.text_value => val.text_value}
366
- end
367
- end
368
-
369
- def _nt_parameter
370
- start_index = index
371
- if node_cache[:parameter].has_key?(index)
372
- cached = node_cache[:parameter][index]
373
- if cached
374
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
375
- @index = cached.interval.end
376
- end
377
- return cached
378
- end
379
-
380
- i0, s0 = index, []
381
- r2 = _nt_CFWS
382
- if r2
383
- r1 = r2
384
- else
385
- r1 = instantiate_node(SyntaxNode,input, index...index)
386
- end
387
- s0 << r1
388
- if r1
389
- r3 = _nt_attribute
390
- s0 << r3
391
- if r3
392
- if has_terminal?("=", false, index)
393
- r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
394
- @index += 1
395
- else
396
- terminal_parse_failure("=")
397
- r4 = nil
398
- end
399
- s0 << r4
400
- if r4
401
- r5 = _nt_value
402
- s0 << r5
403
- if r5
404
- r7 = _nt_CFWS
405
- if r7
406
- r6 = r7
407
- else
408
- r6 = instantiate_node(SyntaxNode,input, index...index)
409
- end
410
- s0 << r6
411
- end
412
- end
413
- end
414
- end
415
- if s0.last
416
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
417
- r0.extend(Parameter0)
418
- r0.extend(Parameter1)
419
- else
420
- @index = i0
421
- r0 = nil
422
- end
423
-
424
- node_cache[:parameter][start_index] = r0
425
-
426
- r0
427
- end
428
-
429
- def _nt_attribute
430
- start_index = index
431
- if node_cache[:attribute].has_key?(index)
432
- cached = node_cache[:attribute][index]
433
- if cached
434
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
435
- @index = cached.interval.end
436
- end
437
- return cached
438
- end
439
-
440
- s0, i0 = [], index
441
- loop do
442
- r1 = _nt_token
443
- if r1
444
- s0 << r1
445
- else
446
- break
447
- end
448
- end
449
- if s0.empty?
450
- @index = i0
451
- r0 = nil
452
- else
453
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
454
- end
455
-
456
- node_cache[:attribute][start_index] = r0
457
-
458
- r0
459
- end
460
-
461
- module Value0
462
- def text_value
463
- quoted_content.text_value
464
- end
465
- end
466
-
467
- def _nt_value
468
- start_index = index
469
- if node_cache[:value].has_key?(index)
470
- cached = node_cache[:value][index]
471
- if cached
472
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
473
- @index = cached.interval.end
474
- end
475
- return cached
476
- end
477
-
478
- i0 = index
479
- r1 = _nt_quoted_string
480
- r1.extend(Value0)
481
- if r1
482
- r0 = r1
483
- else
484
- s2, i2 = [], index
485
- loop do
486
- i3 = index
487
- r4 = _nt_token
488
- if r4
489
- r3 = r4
490
- else
491
- if has_terminal?('\G[\\x3d]', true, index)
492
- r5 = true
493
- @index += 1
494
- else
495
- r5 = nil
496
- end
497
- if r5
498
- r3 = r5
499
- else
500
- @index = i3
501
- r3 = nil
502
- end
503
- end
504
- if r3
505
- s2 << r3
506
- else
507
- break
508
- end
509
- end
510
- if s2.empty?
511
- @index = i2
512
- r2 = nil
513
- else
514
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
515
- end
516
- if r2
517
- r0 = r2
518
- else
519
- @index = i0
520
- r0 = nil
521
- end
522
- end
523
-
524
- node_cache[:value][start_index] = r0
525
-
526
- r0
527
- end
528
-
529
- end
530
-
531
- class ContentDispositionParser < Treetop::Runtime::CompiledParser
532
- include ContentDisposition
533
- end
534
-
535
- end