Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6009987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:03:03+00:00 2026-05-23T02:03:03+00:00

I am using Rails 2.3.11. I created a UserMailer with following methods: def rsvp_created(user,

  • 0

I am using Rails 2.3.11. I created a UserMailer with following methods:

     def rsvp_created(user, rsvp, pdf_file)
        setup_email(user)
        content_type "multipart/mixed"
        @subject << "Your RSVP for #{rsvp.ticket.holiday.title}"
        @body[:rsvp] = rsvp

        attachment :content_type => 'application/pdf', 
                   :body => File.read(pdf_file), 
                   :filename => "#{rsvp.confirmation_number}.pdf"
      end

      def rsvp_cancelled(user, rsvp)
        setup_email(user)
        content_type "text/html"
        @subject << "Cancelled RSVP for #{rsvp.ticket.holiday.title}"
        @body[:rsvp] = rsvp
        @body[:holiday_url] = APP_CONFIG['site_url'] + holiday_path(rsvp.ticket.holiday)
      end

protected
  def setup_email(user)
    @recipients = "#{user.email}"
    @from = APP_CONFIG['admin_email']
    @subject = "[#{APP_CONFIG['site_name']}] "
    @sent_on = Time.now
    @body[:user] = user
  end

The rsvp_cancelled works fine and sends email properly. But the rsvp_created email, which has an attachment, doesn’t work properly. It sends the email with the attached file but doesn’t render any text. Any one faced this issue before or know how I can resolve it?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:03:04+00:00Added an answer on May 23, 2026 at 2:03 am

    With Rails 2.x, for some reason or the other you need to define all the parts for the HTML to appear.

    def rsvp_created(user, rsvp, pdf_file)
      setup_email(user)
      content_type "multipart/mixed"
      @subject << "Your RSVP for #{rsvp.ticket.holiday.title}"
    
      part :content_type => 'multipart/alternative' do |copy|
        copy.part :content_type => 'text/html' do |html|
          html.body = render( :file => "rsvp_created.text.html.erb", 
                              :body => { :rsvp => rsvp } )
        end
      end
    
      attachment :content_type => 'application/pdf', 
                 :body => File.read(pdf_file), 
                 :filename => "#{rsvp.confirmation_number}.pdf"
    
    end
    

    Thankfully it appears this is not the case in Rails 3.x.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While using Rails ActionMailer with Multipart Emails I created both: approve_trade_email.html.erb AND approve_trade_email.text.erb I
I have created Rails database using the following schema: ActiveRecord::Schema.define(:version => 20090807141407) do create_table
I created the /views/user/ folder using rails g devise:views but devise is still using
I am using Rails 2.3 and I decided to provide support for JSONP. Created
I'm using rails 2.3.4 When I execute rake db:test:prepare the id field created is
I cloned one of my own apps using Rails 3.1.3, created an app on
I have created a blog application using Ruby on Rails which includes the ability
using Ruby on Rails 2.3.2, since I already created Scaffold for Story, so instead
I have a Rails 3.2.2 application using Ruby version 1.9.2. I have created basic
Note: Using Rails 3.1 and current delayed_job gem. I have a User model that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.