Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* Don't add charset to content-type header for a part that contains s…

…ubparts (for AOL compatibility) #2013 [John Long]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2091 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 8373b55055f421bb48c375f69d85f6dbbe679649 1 parent a322514
Jamis Buck jamis authored
2  actionmailer/CHANGELOG
View
@@ -1,5 +1,7 @@
*SVN*
+* Don't add charset to content-type header for a part that contains subparts (for AOL compatibility) #2013 [John Long]
+
* Preserve underscores when unquoting message bodies #1930
* Encode multibyte characters correctly #1894
1  actionmailer/lib/action_mailer/base.rb
View
@@ -225,6 +225,7 @@ def create!(method_name, *parameters) #:nodoc:
end
unless @parts.empty?
@content_type = "multipart/alternative"
+ @charset = nil
@parts = sort_parts(@parts, @implicit_parts_order)
end
end
8 actionmailer/lib/action_mailer/vendor/tmail/header.rb
View
@@ -754,9 +754,11 @@ def do_accept( strategy )
strategy.meta @main
end
@params.each do |k,v|
- strategy.meta ';'
- strategy.space
- strategy.kv_pair k, v
+ if v
+ strategy.meta ';'
+ strategy.space
+ strategy.kv_pair k, v
+ end
end
end
20 actionmailer/test/mail_service_test.rb
View
@@ -128,13 +128,14 @@ def explicitly_multipart_example(recipient, ct=nil)
:body => "123456789"
end
- def implicitly_multipart_example(recipient, order = nil)
+ def implicitly_multipart_example(recipient, cs = nil, order = nil)
@recipients = recipient
@subject = "multipart example"
@from = "test@example.com"
@sent_on = Time.local 2004, 12, 12
@body = { "recipient" => recipient }
- @implicit_parts_order = order unless order.nil?
+ @charset = cs if cs
+ @implicit_parts_order = order if order
end
def html_mail(recipient)
@@ -598,8 +599,7 @@ def test_explicitly_multipart_messages
end
def test_explicitly_multipart_with_content_type
- mail = TestMailer.create_explicitly_multipart_example(@recipient,
- "multipart/alternative")
+ mail = TestMailer.create_explicitly_multipart_example(@recipient, "multipart/alternative")
assert_equal 3, mail.parts.length
assert_equal "multipart/alternative", mail.content_type
end
@@ -624,13 +624,23 @@ def test_implicitly_multipart_messages
end
def test_implicitly_multipart_messages_with_custom_order
- mail = TestMailer.create_implicitly_multipart_example(@recipient, ["text/yaml", "text/plain"])
+ mail = TestMailer.create_implicitly_multipart_example(@recipient, nil, ["text/yaml", "text/plain"])
assert_equal 3, mail.parts.length
assert_equal "text/html", mail.parts[0].content_type
assert_equal "text/plain", mail.parts[1].content_type
assert_equal "text/yaml", mail.parts[2].content_type
end
+ def test_implicitly_multipart_messages_with_charset
+ mail = TestMailer.create_implicitly_multipart_example(@recipient, 'iso-8859-1')
+
+ assert_equal "multipart/alternative", mail.header['content-type'].body
+
+ assert_equal 'iso-8859-1', mail.parts[0].sub_header("content-type", "charset")
+ assert_equal 'iso-8859-1', mail.parts[1].sub_header("content-type", "charset")
+ assert_equal 'iso-8859-1', mail.parts[2].sub_header("content-type", "charset")
+ end
+
def test_html_mail
mail = TestMailer.create_html_mail(@recipient)
assert_equal "text/html", mail.content_type
Please sign in to comment.
Something went wrong with that request. Please try again.