提交 a46214c4 编写于 作者: J Jamis Buck

Make custom headers work in subparts (closes #4034)


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3956 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 797de4d0
*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]
......
......@@ -96,7 +96,9 @@ def to_mail(defaults)
part.set_content_type(content_type, nil, { "charset" => charset }) if content_type =~ /multipart/
end
@headers.each { |k,v| part[k] = v }
part
end
......
......@@ -218,6 +218,15 @@ def nested_multipart(recipient)
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 @@ def test_nested_parts
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册