[Rails] Possible bug in ActionMailer (with patch)
elan feingold
elan at bluemandrill.com
Wed Mar 1 09:13:39 GMT 2006
I wanted to write the following code, with emphasis on adding my own
headers to the second part with the :headers parameter.
class ArticleMailer < ActionMailer::Base
def test_message
subject 'This is a test'
recipients 'elan at bluemandrill.com'
from 'Exemplary Products <info at example.com>'
content_type 'multipart/related'
part :content_type => 'text/html',
:body => 'Before <img src="cid:test at test.com"> After'
part :content_type => 'image/png',
:content_disposition => 'inline',
:transfer_encoding => 'base64',
:body => File.read("location.jpg"),
:filename => 'location.jpg',
:headers => { 'Content-ID' => '<test at test.com>' }
end
end
Since ActionMailer::Part looks at params[:headers]. Unfortunately it
never seems to use them! I needed to add:
Index: action_mailer/part.rb
===================================================================
--- action_mailer/part.rb (revision 3679)
+++ action_mailer/part.rb (working copy)
@@ -96,7 +96,8 @@
part.set_content_type(content_type, nil, { "charset" => charset
}) if content_type =~ /multipart/
end
+ @headers.keys.each do |k| part[k] = @headers[k] end
part
end
Does this patch make sense? If not, what am I doing wrong? If so, who
would I submit it to?
Many thanks,
-elan
--
Posted via http://www.ruby-forum.com/.
More information about the Rails
mailing list