<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -84,11 +84,8 @@ module ActionMailer
         end        
       else
         if String === body
-          part = TMail::Mail.new
-          part.body = body
-          part.set_content_type(real_content_type, nil, ctype_attrs)
-          part.set_content_disposition &quot;inline&quot;
-          m.parts &lt;&lt; part
+          @parts.unshift Part.new(:charset =&gt; charset, :body =&gt; @body, :content_type =&gt; 'text/plain')
+          @body = nil
         end
           
         @parts.each do |p|</diff>
      <filename>actionmailer/lib/action_mailer/part.rb</filename>
    </modified>
    <modified>
      <diff>@@ -210,6 +210,16 @@ class TestMailer &lt; ActionMailer::Base
     attachment :content_type =&gt; &quot;application/octet-stream&quot;,:filename =&gt; &quot;test.txt&quot;, :body =&gt; &quot;test abcdefghijklmnopqstuvwxyz&quot;
   end
   
+  def nested_multipart_with_body(recipient)
+    recipients   recipient
+    subject      &quot;nested multipart with body&quot;
+    from         &quot;test@example.com&quot;
+    content_type &quot;multipart/mixed&quot;
+    part :content_type =&gt; &quot;multipart/alternative&quot;, :content_disposition =&gt; &quot;inline&quot;, :body =&gt; &quot;Nothing to see here.&quot; do |p|
+      p.part :content_type =&gt; &quot;text/html&quot;, :body =&gt; &quot;&lt;b&gt;test&lt;/b&gt; HTML&lt;br/&gt;&quot;
+    end
+  end
+
   def attachment_with_custom_header(recipient)
     recipients   recipient
     subject      &quot;custom header in attachment&quot;
@@ -310,6 +320,19 @@ class ActionMailerTest &lt; Test::Unit::TestCase
     assert_equal &quot;application/octet-stream&quot;, created.parts[1].content_type
   end
 
+  def test_nested_parts_with_body
+    created = nil
+    assert_nothing_raised { created = TestMailer.create_nested_multipart_with_body(@recipient)}
+    assert_equal 1,created.parts.size
+    assert_equal 2,created.parts.first.parts.size
+
+    assert_equal &quot;multipart/mixed&quot;, created.content_type
+    assert_equal &quot;multipart/alternative&quot;, created.parts.first.content_type
+    assert_equal &quot;Nothing to see here.&quot;, created.parts.first.parts.first.body
+    assert_equal &quot;text/plain&quot;, created.parts.first.parts.first.content_type
+    assert_equal &quot;text/html&quot;, created.parts.first.parts[1].content_type
+  end
+
   def test_attachment_with_custom_header
     created = nil
     assert_nothing_raised { created = TestMailer.create_attachment_with_custom_header(@recipient)}</diff>
      <filename>actionmailer/test/mail_service_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>fd3f048f6dda74193644e2bbb23044e64df84449</id>
    </parent>
  </parents>
  <author>
    <name>Michael Koziarski</name>
    <email>michael@koziarski.com</email>
  </author>
  <url>http://github.com/rubyruy/rails/commit/1d32cec17d768ac78d52903f5ed8b19cc37c7f78</url>
  <id>1d32cec17d768ac78d52903f5ed8b19cc37c7f78</id>
  <committed-date>2007-11-28T18:52:49-08:00</committed-date>
  <authored-date>2007-11-28T18:52:49-08:00</authored-date>
  <message> Allow body to be specified for nested parts with action mailer.  Closes #10271 [redinger]


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8238 5ecf4fe2-1ee6-0310-87b1-e25e094e27de</message>
  <tree>f8149c5e29a8ad85eed0332c79b76fa62e15d899</tree>
  <committer>
    <name>Michael Koziarski</name>
    <email>michael@koziarski.com</email>
  </committer>
</commit>
