Forum: Ruby on Rails ActionMailer HTML emails appear as HTML code in email client

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
creativetags (Guest)
on 2009-06-08 16:04
(Received via mailing list)
Hi

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

Taken from 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
creativetags (Guest)
on 2009-06-08 16:30
(Received via mailing list)
This article got me working:
http://www.caboo.se/articles/2006/02/19/how-to-sen...

Still seems broken though
This topic is locked and can not be replied to.