# ActionMailer HTML emails appear as HTML code in email client

**URL:** <https://www.ruby-forum.com/t/actionmailer-html-emails-appear-as-html-code-in-email-client/169770>\
**Category:** Rails\
**Created:** [June 8, 2009, 2:04pm UTC](https://www.ruby-forum.com/t/actionmailer-html-emails-appear-as-html-code-in-email-client/169770 "2009-06-08T14:04:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![creativetags](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@creativetags](https://www.ruby-forum.com/u/creativetags)\
**Post date:** [June 8, 2009, 2:04pm UTC](https://www.ruby-forum.com/t/actionmailer-html-emails-appear-as-html-code-in-email-client/169770/1 "2009-06-08T14:04:13Z")

</div>

Hi

I’m trying to send multipart emails with something like this:

Taken from [ActionMailer::Base](http://api.rubyonrails.org/classes/ActionMailer/Base.html)

[code=] class ApplicationMailer \< ActionMailer::Base  
def signup\_notification(recipient)  
recipients recipient.email\_address\_with\_name  
subject “New account information”  
from “removed\_email\_address@domain.invalid”  
content\_type “multipart/alternative”

```
  part :content_type => "text/html",
    :body => render_message("signup-as-html", :account =>

```

recipient)

```
  part "text/plain" do |p|
    p.body = render_message("signup-as-plain", :account =>

```

recipient)  
p.transfer\_encoding = “base64”  
end  
end  
end[/code]  
I have 2 view files signup-as-html.text.html.erb and signup-as-  
plain.text.plain.erb

I sent a test email and picked it up in Apple Mail but it displays the  
HTML code instead of rendering it.

Any idea why?

Mark

---

<div class="post-metadata">

**Author:** ![creativetags](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@creativetags](https://www.ruby-forum.com/u/creativetags)\
**Post date:** [June 8, 2009, 2:30pm UTC](https://www.ruby-forum.com/t/actionmailer-html-emails-appear-as-html-code-in-email-client/169770/2 "2009-06-08T14:30:43Z")

</div>

This article got me working:  
[http://www.caboo.se/articles/2006/02/19/how-to-send-multipart-alternative-e-mail-with-inline-attachments](http://www.caboo.se/articles/2006/02/19/how-to-send-multipart-alternative-e-mail-with-inline-attachments)

Still seems broken though
