Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 3956

Show
Ignore:
Timestamp:
03/18/06 23:06:25 (3 years ago)
Author:
minam
Message:

Make custom headers work in subparts (closes #4034)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionmailer/CHANGELOG

    r3495 r3956  
    11*SVN* 
     2 
     3* Make custom headers work in subparts #4034 [elan@bluemandrill.com] 
    24 
    35* Template paths with dot chars in them no longer mess up implicit template selection for multipart messages #3332 [Chad Fowler] 
  • trunk/actionmailer/lib/action_mailer/part.rb

    r2648 r3956  
    9797        part.set_content_type(content_type, nil, { "charset" => charset }) if content_type =~ /multipart/ 
    9898      end 
    99      
     99 
     100      @headers.each { |k,v| part[k] = v } 
     101 
    100102      part 
    101103    end 
  • trunk/actionmailer/test/mail_service_test.rb

    r3652 r3956  
    219219    attachment :content_type => "application/octet-stream",:filename => "test.txt", :body => "test abcdefghijklmnopqstuvwxyz" 
    220220  end 
     221   
     222  def attachment_with_custom_header(recipient) 
     223    recipients   recipient 
     224    subject      "custom header in attachment" 
     225    from         "test@example.com" 
     226    content_type "multipart/related" 
     227    part :content_type => "text/html", :body => 'yo' 
     228    attachment :content_type => "image/jpeg",:filename => "test.jpeg", :body => "i am not a real picture", :headers => { 'Content-ID' => '<test@test.com>' } 
     229  end 
    221230 
    222231  def unnamed_attachment(recipient) 
     
    283292    assert_equal "text/html", created.parts.first.parts[1].content_type 
    284293    assert_equal "application/octet-stream", created.parts[1].content_type 
     294  end 
     295 
     296  def test_attachment_with_custom_header 
     297    created = nil 
     298    assert_nothing_raised { created = TestMailer.create_attachment_with_custom_header(@recipient)} 
     299    assert_equal "<test@test.com>", created.parts[1].header['content-id'].to_s 
    285300  end 
    286301