# Problem with implicit multipart emails using ActionMailer in Rails 2.3.3

**URL:** <https://www.ruby-forum.com/t/problem-with-implicit-multipart-emails-using-actionmailer-in-rails-2-3-3/173001>\
**Category:** Rails\
**Created:** [July 31, 2009, 1:29am UTC](https://www.ruby-forum.com/t/problem-with-implicit-multipart-emails-using-actionmailer-in-rails-2-3-3/173001 "2009-07-31T01:29:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sven](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e47c2d/32.png) [@sven](https://www.ruby-forum.com/u/sven)\
**Post date:** [July 31, 2009, 1:29am UTC](https://www.ruby-forum.com/t/problem-with-implicit-multipart-emails-using-actionmailer-in-rails-2-3-3/173001/1 "2009-07-31T01:29:50Z")

</div>

With earlier versions of Rails ActionMailer used to implicitly send  
multipart (text/plain and text/html) email messages for me, but it  
looks like now it’s sending two text/plain parts.

Simplified details:

Here’s my model:

class Notifications \< ActionMailer::Base  
def confirmation(sent\_at = Time.now)  
@subject = ‘Thank you for registering’  
@body = {}  
@recipients = ‘removed\_email\_address@domain.invalid’  
@from = ‘removed\_email\_address@domain.invalid’  
@sent\_on = sent\_at  
@headers = {}  
end  
end

I have two views called confirmation.text.plain.erb and  
confirmation.text.html.erb

In a unit test, for debug purposes, I have:  
sent = Notifications.create\_confirmation  
puts sent.to\_s

The resulting message looks like this:

* * *

Date: Thu, 30 Jul 2009 17:45:04 -0400  
From: removed\_email\_address@domain.invalid\>  
To: removed\_email\_address@domain.invalid  
Subject: Thank you for registering  
Mime-Version: 1.0  
Content-Type: multipart/alternative;  
boundary=mimepart\_4a72146057a58\_11b414263a41e

–mimepart\_4a72146057a58\_11b414263a41e  
Mime-Version: 1.0  
Content-Type: text/plain; charset=iso-2022-jp  
Content-Transfer-Encoding: 7bit  
Content-Disposition: inline

Message text from confirmation.text.plain.erb

–mimepart\_4a72146057a58\_11b414263a41e  
Mime-Version: 1.0  
Content-Type: text/plain; charset=iso-2022-jp  
Content-Transfer-Encoding: 7bit  
Content-Disposition: inline

Message text from confirmation.text.html.erb

## –mimepart\_4a72146057a58\_11b414263a41e–

The second message part should have a content-type of text/html, but  
it doesn’t (any more; this worked in the past).

This happens regardless of whether I run test\unit  
\notifications\_test.rb directly or whether I run it via rake  
test:units.

Searching for more information led me to a similar problem with Rails  
2.3.2 and I tried the fix suggested at  
[https://rails.lighthouseapp.com/projects/8994/tickets/2263-rails-232-breaks-implicit-multipart-actionmailer-tests#ticket-2263-23](https://rails.lighthouseapp.com/projects/8994/tickets/2263-rails-232-breaks-implicit-multipart-actionmailer-tests#ticket-2263-23)  
but it isn’t helping.

Does anyone know why the implicit multipart functionality isn’t  
working for me?

Thanks,

Sven
