aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2006-03-19 00:18:50 +0000
committerJamis Buck <jamis@37signals.com>2006-03-19 00:18:50 +0000
commit49efa02b9e8d868b2d28a3db76269d8b8fcde0a6 (patch)
tree0ec96c2e208dcecc1fff84ad85ba61dce3499871
parentdb0e8ff1c3496841d7a307794dacecd82e55ce6a (diff)
downloadrails-49efa02b9e8d868b2d28a3db76269d8b8fcde0a6.tar.gz
rails-49efa02b9e8d868b2d28a3db76269d8b8fcde0a6.tar.bz2
rails-49efa02b9e8d868b2d28a3db76269d8b8fcde0a6.zip
Nil charset caused subject line to be improperly quoted in implicitly multipart messages (closes #2662)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3960 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionmailer/CHANGELOG2
-rw-r--r--actionmailer/lib/action_mailer/base.rb6
-rwxr-xr-xactionmailer/test/mail_service_test.rb13
3 files changed, 19 insertions, 2 deletions
diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG
index 82497e324e..b0dc63826c 100644
--- a/actionmailer/CHANGELOG
+++ b/actionmailer/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Nil charset caused subject line to be improperly quoted in implicitly multipart messages #2662 [ehalvorsen+rails@runbox.com]
+
* Parse content-type apart before using it so that sub-parts of the header can be set correctly #2918 [Jamis Buck]
* Make custom headers work in subparts #4034 [elan@bluemandrill.com]
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 42d48fd5a6..03d8760d8f 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -293,7 +293,6 @@ module ActionMailer
end
unless @parts.empty?
@content_type = "multipart/alternative"
- @charset = nil
@parts = sort_parts(@parts, @implicit_parts_order)
end
end
@@ -432,7 +431,10 @@ module ActionMailer
m.parts << part
end
- m.set_content_type(real_content_type, nil, ctype_attrs) if real_content_type =~ /multipart/
+ if real_content_type =~ /multipart/
+ ctype_attrs.delete "charset"
+ m.set_content_type(real_content_type, nil, ctype_attrs)
+ end
end
@mail = m
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb
index 0689bf6728..c810cf1090 100755
--- a/actionmailer/test/mail_service_test.rb
+++ b/actionmailer/test/mail_service_test.rb
@@ -167,6 +167,14 @@ class TestMailer < ActionMailer::Base
@implicit_parts_order = order if order
end
+ def implicitly_multipart_with_utf8
+ recipients "no.one@nowhere.test"
+ subject "Foo áëô îü"
+ from "some.one@somewhere.test"
+ template "implicitly_multipart_example"
+ body ({ "recipient" => "no.one@nowhere.test" })
+ end
+
def html_mail(recipient)
recipients recipient
subject "html mail"
@@ -646,6 +654,11 @@ EOF
assert_match(/\nSubject: =\?utf-8\?Q\?Foo_.*?\?=/, mail.encoded)
end
+ def test_implicitly_multipart_with_utf8
+ mail = TestMailer.create_implicitly_multipart_with_utf8
+ assert_match(/\nSubject: =\?utf-8\?Q\?Foo_.*?\?=/, mail.encoded)
+ end
+
def test_explicitly_multipart_messages
mail = TestMailer.create_explicitly_multipart_example(@recipient)
assert_equal 3, mail.parts.length