mail 2.2.2 → 2.2.3
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.
- data/CHANGELOG.rdoc +4 -0
- data/VERSION.yml +1 -1
- data/lib/mail/attachments_list.rb +7 -1
- data/lib/mail/message.rb +2 -1
- data/lib/mail/part.rb +14 -0
- metadata +2 -2
data/CHANGELOG.rdoc
CHANGED
data/VERSION.yml
CHANGED
@@ -3,6 +3,7 @@ module Mail
|
|
3
3
|
|
4
4
|
def initialize(parts_list)
|
5
5
|
@parts_list = parts_list
|
6
|
+
@content_disposition_type = 'attachment'
|
6
7
|
parts_list.map { |p|
|
7
8
|
if p.content_type == "message/rfc822"
|
8
9
|
Mail.new(p.body).attachments
|
@@ -15,6 +16,11 @@ module Mail
|
|
15
16
|
self
|
16
17
|
end
|
17
18
|
|
19
|
+
def inline
|
20
|
+
@content_disposition_type = 'inline'
|
21
|
+
self
|
22
|
+
end
|
23
|
+
|
18
24
|
# Returns the attachment by filename or at index.
|
19
25
|
#
|
20
26
|
# mail.attachments['test.png'] = File.read('test.png')
|
@@ -33,7 +39,7 @@ module Mail
|
|
33
39
|
def []=(name, value)
|
34
40
|
default_values = { :content_type => "#{set_mime_type(name)}; filename=\"#{name}\"",
|
35
41
|
:content_transfer_encoding => "#{guess_encoding}",
|
36
|
-
:content_disposition => "
|
42
|
+
:content_disposition => "#{@content_disposition_type}; filename=\"#{name}\"" }
|
37
43
|
|
38
44
|
if value.is_a?(Hash)
|
39
45
|
|
data/lib/mail/message.rb
CHANGED
@@ -1644,6 +1644,7 @@ module Mail
|
|
1644
1644
|
# ready to send
|
1645
1645
|
def ready_to_send!
|
1646
1646
|
identify_and_set_transfer_encoding
|
1647
|
+
parts.sort!([ "text/plain", "text/enriched", "text/html", "multipart/alternative" ])
|
1647
1648
|
parts.each do |part|
|
1648
1649
|
part.transport_encoding = transport_encoding
|
1649
1650
|
part.ready_to_send!
|
@@ -1695,7 +1696,7 @@ module Mail
|
|
1695
1696
|
end
|
1696
1697
|
|
1697
1698
|
def decode_body
|
1698
|
-
|
1699
|
+
body.decoded
|
1699
1700
|
end
|
1700
1701
|
|
1701
1702
|
# Returns true if this part is an attachment
|
data/lib/mail/part.rb
CHANGED
@@ -19,10 +19,24 @@ module Mail
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def inline_content_id
|
22
|
+
# TODO: Deprecated in 2.2.2 - Remove in 2.3
|
23
|
+
STDERR.puts("Part#inline_content_id is deprecated, please call Part#cid instead")
|
24
|
+
cid
|
25
|
+
end
|
26
|
+
|
27
|
+
def cid
|
22
28
|
add_content_id unless has_content_id?
|
23
29
|
uri_escape(unbracket(content_id))
|
24
30
|
end
|
25
31
|
|
32
|
+
def url
|
33
|
+
"cid:#{cid}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def inline?
|
37
|
+
header[:content_disposition].disposition_type == 'inline' if header[:content_disposition]
|
38
|
+
end
|
39
|
+
|
26
40
|
def add_required_fields
|
27
41
|
add_content_id unless has_content_id?
|
28
42
|
super
|