mail 2.4.4 → 2.5.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of mail might be problematic. Click here for more details.

Files changed (45) hide show
  1. data/CHANGELOG.rdoc +60 -0
  2. data/Gemfile +1 -1
  3. data/README.md +11 -10
  4. data/lib/VERSION +2 -2
  5. data/lib/load_parsers.rb +41 -0
  6. data/lib/mail.rb +18 -17
  7. data/lib/mail/body.rb +2 -2
  8. data/lib/mail/check_delivery_params.rb +30 -0
  9. data/lib/mail/configuration.rb +1 -1
  10. data/lib/mail/core_extensions/nil.rb +4 -2
  11. data/lib/mail/core_extensions/shell_escape.rb +1 -1
  12. data/lib/mail/elements.rb +12 -12
  13. data/lib/mail/encodings.rb +8 -10
  14. data/lib/mail/encodings/quoted_printable.rb +1 -1
  15. data/lib/mail/field.rb +73 -95
  16. data/lib/mail/fields.rb +32 -32
  17. data/lib/mail/fields/common/common_address.rb +6 -1
  18. data/lib/mail/fields/common/common_field.rb +7 -1
  19. data/lib/mail/fields/common/common_message_id.rb +9 -5
  20. data/lib/mail/fields/content_disposition_field.rb +1 -0
  21. data/lib/mail/fields/content_type_field.rb +4 -1
  22. data/lib/mail/fields/keywords_field.rb +1 -1
  23. data/lib/mail/fields/unstructured_field.rb +33 -26
  24. data/lib/mail/header.rb +32 -13
  25. data/lib/mail/message.rb +8 -9
  26. data/lib/mail/multibyte/chars.rb +2 -2
  27. data/lib/mail/multibyte/unicode.rb +6 -0
  28. data/lib/mail/network.rb +9 -9
  29. data/lib/mail/network/delivery_methods/exim.rb +5 -1
  30. data/lib/mail/network/delivery_methods/file_delivery.rb +5 -0
  31. data/lib/mail/network/delivery_methods/sendmail.rb +5 -0
  32. data/lib/mail/network/delivery_methods/smtp.rb +11 -19
  33. data/lib/mail/network/delivery_methods/smtp_connection.rb +5 -18
  34. data/lib/mail/network/delivery_methods/test_mailer.rb +5 -1
  35. data/lib/mail/network/retriever_methods/imap.rb +14 -6
  36. data/lib/mail/network/retriever_methods/pop3.rb +2 -2
  37. data/lib/mail/network/retriever_methods/test_retriever.rb +11 -15
  38. data/lib/mail/parsers/rfc2822.rb +77 -21
  39. data/lib/mail/parsers/rfc2822.treetop +3 -3
  40. data/lib/mail/patterns.rb +0 -1
  41. data/lib/mail/values/unicode_tables.dat +0 -0
  42. data/lib/mail/version_specific/ruby_1_8.rb +18 -1
  43. data/lib/mail/version_specific/ruby_1_9.rb +7 -1
  44. metadata +27 -10
  45. data/Gemfile.lock +0 -36
@@ -110,7 +110,7 @@ module Mail
110
110
  end
111
111
 
112
112
  rule local_dot_atom_text
113
- ("."? domain_text)+
113
+ ("."* domain_text "."*)+
114
114
  end
115
115
 
116
116
  rule domain_text
@@ -218,7 +218,7 @@ module Mail
218
218
  end
219
219
 
220
220
  rule mailbox_list
221
- (first_addr:mailbox other_addr:("," addr_value:mailbox)*) / obs_mbox_list
221
+ (first_addr:mailbox other_addr:(("," / ";") addr_value:mailbox)*) / obs_mbox_list
222
222
  end
223
223
 
224
224
  rule mailbox
@@ -265,7 +265,7 @@ module Mail
265
265
  end
266
266
 
267
267
  rule address_list
268
- first_addr:address? other_addr:(FWS* "," FWS* addr_value:address?)*
268
+ first_addr:address? other_addr:(FWS* ("," / ";") FWS* addr_value:address?)*
269
269
  end
270
270
 
271
271
  rule date_time
@@ -8,7 +8,6 @@ module Mail
8
8
 
9
9
  aspecial = %Q|()<>[]:;@\\,."| # RFC5322
10
10
  tspecial = %Q|()<>@,;:\\"/[]?=| # RFC2045
11
- lwsp = %Q| \t\r\n|
12
11
  sp = %Q| |
13
12
  control = %Q|\x00-\x1f\x7f-\xff|
14
13
 
@@ -3,6 +3,7 @@
3
3
  module Mail
4
4
  class Ruby18
5
5
  require 'base64'
6
+ require 'iconv'
6
7
 
7
8
  # Escapes any parenthesis in a string that are unescaped. This can't
8
9
  # use the Ruby 1.9.1 regexp feature of negative look behind so we have
@@ -65,6 +66,7 @@ module Mail
65
66
  if match
66
67
  encoding = match[1]
67
68
  str = Ruby18.decode_base64(match[2])
69
+ str = Iconv.conv('UTF-8//IGNORE', fix_encoding(encoding), str)
68
70
  end
69
71
  str
70
72
  end
@@ -80,7 +82,11 @@ module Mail
80
82
  match = str.match(/\=\?(.+)?\?[Qq]\?(.+)?\?\=/m)
81
83
  if match
82
84
  encoding = match[1]
83
- str = Encodings::QuotedPrintable.decode(match[2].gsub(/_/, '=20'))
85
+ string = match[2].gsub(/_/, '=20')
86
+ # Remove trailing = if it exists in a Q encoding
87
+ string = string.sub(/\=$/, '')
88
+ str = Encodings::QuotedPrintable.decode(string)
89
+ str = Iconv.conv('UTF-8//IGNORE', fix_encoding(encoding), str)
84
90
  end
85
91
  str
86
92
  end
@@ -94,5 +100,16 @@ module Mail
94
100
  language = Configuration.instance.param_encode_language
95
101
  "#{encoding}'#{language}'#{URI.escape(str)}"
96
102
  end
103
+
104
+ private
105
+
106
+ def Ruby18.fix_encoding(encoding)
107
+ case encoding.upcase
108
+ when 'UTF8'
109
+ 'UTF-8'
110
+ else
111
+ encoding
112
+ end
113
+ end
97
114
  end
98
115
  end
@@ -68,11 +68,16 @@ module Mail
68
68
  match = str.match(/\=\?(.+)?\?[Qq]\?(.+)?\?\=/m)
69
69
  if match
70
70
  encoding = match[1]
71
- str = Encodings::QuotedPrintable.decode(match[2].gsub(/_/, '=20'))
71
+ string = match[2].gsub(/_/, '=20')
72
+ # Remove trailing = if it exists in a Q encoding
73
+ string = string.sub(/\=$/, '')
74
+ str = Encodings::QuotedPrintable.decode(string)
72
75
  str.force_encoding(fix_encoding(encoding))
73
76
  end
74
77
  decoded = str.encode("utf-8", :invalid => :replace, :replace => "")
75
78
  decoded.valid_encoding? ? decoded : decoded.encode("utf-16le", :invalid => :replace, :replace => "").encode("utf-8")
79
+ rescue Encoding::UndefinedConversionError
80
+ str.dup.force_encoding("utf-8")
76
81
  end
77
82
 
78
83
  def Ruby19.param_decode(str, encoding)
@@ -105,6 +110,7 @@ module Mail
105
110
  when /utf-?(\d{1,2})?(\w{1,2})/i then return "UTF-#{$1}#{$2}".gsub(/\A(UTF-(?:16|32))\z/, '\\1BE')
106
111
  # Windows-1252 and alike
107
112
  when /Windows-?(.*)/i then return "Windows-#{$1}"
113
+ when /^8bit$/ then return "ASCII-8BIT"
108
114
  #more aliases to be added if needed
109
115
  else return encoding
110
116
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.4
4
+ version: 2.5.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-14 00:00:00.000000000Z
12
+ date: 2012-11-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mime-types
16
- requirement: &70305676450460 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '1.16'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70305676450460
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.16'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: treetop
27
- requirement: &70305676449980 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 1.4.8
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70305676449980
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.4.8
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: i18n
38
- requirement: &70305676449520 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,7 +53,12 @@ dependencies:
43
53
  version: 0.4.0
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70305676449520
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.4.0
47
62
  description: A really Ruby Mail handler.
48
63
  email: raasdnil@gmail.com
49
64
  executables: []
@@ -59,11 +74,12 @@ files:
59
74
  - CHANGELOG.rdoc
60
75
  - Dependencies.txt
61
76
  - Gemfile
62
- - Gemfile.lock
63
77
  - Rakefile
64
78
  - TODO.rdoc
79
+ - lib/load_parsers.rb
65
80
  - lib/mail/attachments_list.rb
66
81
  - lib/mail/body.rb
82
+ - lib/mail/check_delivery_params.rb
67
83
  - lib/mail/configuration.rb
68
84
  - lib/mail/core_extensions/nil.rb
69
85
  - lib/mail/core_extensions/object.rb
@@ -187,6 +203,7 @@ files:
187
203
  - lib/mail/parts_list.rb
188
204
  - lib/mail/patterns.rb
189
205
  - lib/mail/utilities.rb
206
+ - lib/mail/values/unicode_tables.dat
190
207
  - lib/mail/version.rb
191
208
  - lib/mail/version_specific/ruby_1_8.rb
192
209
  - lib/mail/version_specific/ruby_1_9.rb
@@ -214,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
231
  version: '0'
215
232
  requirements: []
216
233
  rubyforge_project:
217
- rubygems_version: 1.8.15
234
+ rubygems_version: 1.8.24
218
235
  signing_key:
219
236
  specification_version: 3
220
237
  summary: Mail provides a nice Ruby DSL for making, sending and reading emails.
@@ -1,36 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- activesupport (3.0.6)
5
- bouncy-castle-java (1.5.0146.1)
6
- diff-lcs (1.1.3)
7
- i18n (0.5.0)
8
- jruby-openssl (0.7.4)
9
- bouncy-castle-java
10
- mime-types (1.16)
11
- polyglot (0.3.3)
12
- rake (0.9.2.2)
13
- rspec (2.8.0)
14
- rspec-core (~> 2.8.0)
15
- rspec-expectations (~> 2.8.0)
16
- rspec-mocks (~> 2.8.0)
17
- rspec-core (2.8.0)
18
- rspec-expectations (2.8.0)
19
- diff-lcs (~> 1.1.2)
20
- rspec-mocks (2.8.0)
21
- treetop (1.4.10)
22
- polyglot
23
- polyglot (>= 0.3.1)
24
-
25
- PLATFORMS
26
- java
27
- ruby
28
-
29
- DEPENDENCIES
30
- activesupport (>= 2.3.6)
31
- i18n (>= 0.4.0)
32
- jruby-openssl
33
- mime-types (~> 1.16)
34
- rake (> 0.8.7)
35
- rspec (~> 2.8.0)
36
- treetop (~> 1.4.10)