Forum: Ruby on Rails Possible bug in ActionMailer (with patch)

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Elan F. (Guest)
on 2006-03-01 11:13
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      'removed_email_address@domain.invalid'
    from            'Exemplary P. <removed_email_address@domain.invalid>'
    content_type    'multipart/related'

    part :content_type => 'text/html',
         :body => 'Before <img src="cid:removed_email_address@domain.invalid"> 

    part :content_type => 'image/png',
         :content_disposition => 'inline',
         :transfer_encoding => 'base64',
         :body =>"location.jpg"),
         :filename => 'location.jpg',
         :headers => { 'Content-ID' => '<removed_email_address@domain.invalid>' 

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/

+      @headers.keys.each do |k| part[k] = @headers[k] end

Does this patch make sense? If not, what am I doing wrong? If so, who
would I submit it to?

Many thanks,

This topic is locked and can not be replied to.