Permalink
Browse files

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
  • Loading branch information...
jamis committed Mar 19, 2006
1 parent db0e8ff commit 49efa02b9e8d868b2d28a3db76269d8b8fcde0a6
Showing with 19 additions and 2 deletions.
  1. +2 −0 actionmailer/CHANGELOG
  2. +4 −2 actionmailer/lib/action_mailer/base.rb
  3. +13 −0 actionmailer/test/mail_service_test.rb
View
@@ -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]
@@ -293,7 +293,6 @@ 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
@@ -432,7 +431,10 @@ def create_mail
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
@@ -167,6 +167,14 @@ def implicitly_multipart_example(recipient, cs = nil, order = nil)
@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 @@ def test_multipart_with_utf8_subject
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

0 comments on commit 49efa02

Please sign in to comment.