diff options
-rw-r--r-- | actionmailer/CHANGELOG | 2 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/base.rb | 1 | ||||
-rwxr-xr-x | actionmailer/lib/action_mailer/vendor/tmail/header.rb | 8 | ||||
-rwxr-xr-x | actionmailer/test/mail_service_test.rb | 20 |
4 files changed, 23 insertions, 8 deletions
diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG index 1d4118ebff..914e93a24b 100644 --- a/actionmailer/CHANGELOG +++ b/actionmailer/CHANGELOG @@ -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 diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 089b2ef0f6..699714c78f 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -225,6 +225,7 @@ module ActionMailer #:nodoc: end unless @parts.empty? @content_type = "multipart/alternative" + @charset = nil @parts = sort_parts(@parts, @implicit_parts_order) end end diff --git a/actionmailer/lib/action_mailer/vendor/tmail/header.rb b/actionmailer/lib/action_mailer/vendor/tmail/header.rb index 73639b5629..b4ef1809f0 100755 --- a/actionmailer/lib/action_mailer/vendor/tmail/header.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail/header.rb @@ -754,9 +754,11 @@ module TMail 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 diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index c181b14f9a..e7a8b9c372 100755 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -128,13 +128,14 @@ class TestMailer < ActionMailer::Base :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 @@ EOF 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 @@ EOF 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 |