# Multipart emails

**URL:** <https://www.ruby-forum.com/t/multipart-emails/88283>\
**Category:** Rails\
**Created:** [March 9, 2007, 11:54am UTC](https://www.ruby-forum.com/t/multipart-emails/88283 "2007-03-09T11:54:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jc71229](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bb73d2/32.png) [@jc71229](https://www.ruby-forum.com/u/jc71229)\
**Post date:** [March 9, 2007, 11:54am UTC](https://www.ruby-forum.com/t/multipart-emails/88283/1 "2007-03-09T11:54:45Z")

</div>

Hi,

I use the multipart functionality from the action mailer and  
I do in my Mailer model this:

class Mailer \< ActionMailer::Base

def confirm(order)  
subject ‘Your order’  
recipients order[:email]  
from ‘removed\_email\_address@domain.invalid’  
sent\_on Time.now  
body(:order =\> order)

# content\_type “multipart/alternative”

# part :content\_type =\> “text/html”,

# :body =\> render\_message(“confirm.text.html.rhtml”, :order =\>

order)

# part “text/plain” do |p|

# p.body = render\_message(“confirm.text.plain.rhtml”, :order =\>

order)

# p.transfer\_encoding = “base64”

# end

end  
end

I can receive the email (in my production environment), but the content  
type is always something like:

“Content-Type: text/html;  
boundary=mimepart\_45f03184878a7\_1ddc15a2cfc76898250”

instead of the expected “Content-Type: multipart/alternative;  
boundary=…”

I can clearly see the two parts (the plain text and the html), but not  
one or the other. Always both at the same time with wrong character  
encoding. I have tried to set the content\_type explicitly, but no luck.

Am I missing something obvious? Any help appreciated!  
Thanks in advance  
Jens
