I want multipart/alternative; ActionMailer only sending text/html

Posted by macek on Stack Overflow See other posts from Stack Overflow or by macek
Published on 2010-04-21T23:10:30Z Indexed on 2010/04/21 23:13 UTC
Read the original article Hit count: 281

I'm following the Ruby on Rails Guide: ActionMailer Basics Section 2.7

Snippet:

Action Mailer will automatically send multipart emails if you have different templates for the same action. So, for our UserMailer example, if you have welcome_email.text.plain.erb and welcome_email.text.html.erb in app/views/user_mailer, Action Mailer will automatically send a multipart email with the HTML and text versions setup as different parts.

Well, I have both:

  1. app/views/user_mailer/welcome_mail.text.html.erb
  2. app/views/user_mailer/welcome_mail.text.plain.erb

app/models/user_mailer.rb

class UserMailer < ActionMailer::Base

  def welcome_mail(user)
    recipients        user.email
    from              "[email protected]"
    subject           "Thanks for registering"
    body              :user => user
  end

end

Any luck?

© Stack Overflow or respective owner

Related posts about actionmailer

Related posts about ruby-on-rails