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 ‘[email protected]’
from ‘Exemplary P. [email protected]’
content_type ‘multipart/related’
part :content_type => 'text/html',
:body => 'Before <img src="cid:[email protected]"> After'
part :content_type => 'image/png',
:content_disposition => 'inline',
:transfer_encoding => 'base64',
:body => File.read("location.jpg"),
:filename => 'location.jpg',
:headers => { 'Content-ID' => '<[email protected]>' }
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
-
end@headers.keys.each do |k| part[k] = @headers[k] end part
Does this patch make sense? If not, what am I doing wrong? If so, who
would I submit it to?
Many thanks,
-elan