Permalink
Browse files

added boundary string when using multipart/alternative (fix #3090)

  • Loading branch information...
1 parent 960882f commit 211b2d4d573ad8b08f0994b2b7efbe133f4866be @kennyj committed Oct 20, 2011
Showing with 4 additions and 3 deletions.
  1. +3 −2 actionmailer/lib/action_mailer/old_api.rb
  2. +1 −1 actionmailer/test/old_base/mail_service_test.rb
@@ -167,6 +167,7 @@ def create_mail
if real_content_type =~ /multipart/
ctype_attrs.delete "charset"
m.content_type([main_type, sub_type, ctype_attrs])
+ m.body.boundary = ctype_attrs["boundary"] if ctype_attrs.has_key?("boundary")
end
end
@@ -206,8 +207,8 @@ def create_parts
@parts << create_inline_part(render(:template => template), template.mime_type)
end
- if @parts.size > 1
- @content_type = "multipart/alternative" if @content_type !~ /^multipart/
+ if @parts.size > 1 && @content_type !~ /^multipart/
+ @content_type = Mail::ContentTypeField.with_boundary("multipart/alternative").value
end
# If this is a multipart e-mail add the mime_version if it is not
@@ -935,7 +935,7 @@ def test_implicitly_multipart_messages_with_custom_order
def test_implicitly_multipart_messages_with_charset
mail = TestMailer.implicitly_multipart_example(@recipient, 'iso-8859-1')
- assert_equal "multipart/alternative", mail.header['content-type'].content_type
+ assert_match %r{^multipart/alternative; boundary="--==_mimepart_.+"$}, mail.header['content-type'].to_s
assert_equal 'iso-8859-1', mail.parts[0].content_type_parameters[:charset]
assert_equal 'iso-8859-1', mail.parts[1].content_type_parameters[:charset]

0 comments on commit 211b2d4

Please sign in to comment.