diff options
author | Jamis Buck <jamis@37signals.com> | 2006-03-18 23:06:25 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2006-03-18 23:06:25 +0000 |
commit | a46214c4f9e7117796f2a5ed1414a83c2ca4c6bd (patch) | |
tree | 6ffcb1793b324c3699e0f77aef6579139ea14518 | |
parent | 797de4d057ff226e4e7d689da537472396bf6f86 (diff) | |
download | rails-a46214c4f9e7117796f2a5ed1414a83c2ca4c6bd.tar.gz rails-a46214c4f9e7117796f2a5ed1414a83c2ca4c6bd.tar.bz2 rails-a46214c4f9e7117796f2a5ed1414a83c2ca4c6bd.zip |
Make custom headers work in subparts (closes #4034)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3956 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | actionmailer/CHANGELOG | 2 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/part.rb | 4 | ||||
-rwxr-xr-x | actionmailer/test/mail_service_test.rb | 15 |
3 files changed, 20 insertions, 1 deletions
diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG index 3320ede638..28c5803535 100644 --- a/actionmailer/CHANGELOG +++ b/actionmailer/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Make custom headers work in subparts #4034 [elan@bluemandrill.com] + * Template paths with dot chars in them no longer mess up implicit template selection for multipart messages #3332 [Chad Fowler] * Make sure anything with content-disposition of "attachment" is passed to the attachment presenter when parsing an email body [Jamis Buck] diff --git a/actionmailer/lib/action_mailer/part.rb b/actionmailer/lib/action_mailer/part.rb index 0036d04da0..7bdbf5345d 100644 --- a/actionmailer/lib/action_mailer/part.rb +++ b/actionmailer/lib/action_mailer/part.rb @@ -96,7 +96,9 @@ module ActionMailer part.set_content_type(content_type, nil, { "charset" => charset }) if content_type =~ /multipart/ end - + + @headers.each { |k,v| part[k] = v } + part end diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 519ca85290..b60b1c1b8b 100755 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -218,6 +218,15 @@ class TestMailer < ActionMailer::Base end attachment :content_type => "application/octet-stream",:filename => "test.txt", :body => "test abcdefghijklmnopqstuvwxyz" end + + def attachment_with_custom_header(recipient) + recipients recipient + subject "custom header in attachment" + from "test@example.com" + content_type "multipart/related" + part :content_type => "text/html", :body => 'yo' + attachment :content_type => "image/jpeg",:filename => "test.jpeg", :body => "i am not a real picture", :headers => { 'Content-ID' => '<test@test.com>' } + end def unnamed_attachment(recipient) recipients recipient @@ -284,6 +293,12 @@ class ActionMailerTest < Test::Unit::TestCase assert_equal "application/octet-stream", created.parts[1].content_type end + def test_attachment_with_custom_header + created = nil + assert_nothing_raised { created = TestMailer.create_attachment_with_custom_header(@recipient)} + assert_equal "<test@test.com>", created.parts[1].header['content-id'].to_s + end + def test_signed_up expected = new_mail expected.to = @recipient |