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 8875361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:57:29+00:00 2026-06-14T18:57:29+00:00

In rails 2.3.5 we were able to attach emails as attachments to other emails

  • 0

In rails 2.3.5 we were able to attach emails as attachments to other emails which were multipart emails using the following code:

 recipients to
   from       from
   subject    subject
   content_type "multipart/mixed" 

   part "text/html" do |p| 
     p.body = render_message("rampup_notification.text.html.erb", :mailbody => body)  
   end 

   part "text/plain" do  |p| 
     p.body = render_message("rampup_notification.text.plain.erb", :mailbody => body) 
   end 

    email = enrollment_application.email
   if email != nil && email.raw_email != nil
     attachment :content_type => "message/rfc822", :filename => "icann.eml", :body => email.raw_email, :transfer_encoding => '7bit'
   end

This was very temperamental to get to work with outlook, exchange etc along with other mailers.

How do I do this in rails 3?

I see: http://www.rubydoc.info/docs/rails/3.0.0/ActionMailer/Base:attachments

 encoded_content = SpecialEncode(File.read('/path/to/filename.jpg'))
 attachments['filename.jpg'] = {:mime_type => 'application/x-gzip',
                           :encoding => 'SpecialEncoding',
                           :content => encoded_content }

But I dont understand how to use this, is SpecialEncode a class I need to write that does 7bit encoding?

thanks
Joel

  • 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-06-14T18:57:30+00:00Added an answer on June 14, 2026 at 6:57 pm

    So it turns out rails 3 actionmailer is pretty smart, this seems to work fine:

    @mailbody = body
    attachments["icann.eml"] = {:content => email.raw_email }
    mail(:to => to, :from => from, :subject => subject) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to be able to invoke a file download from rails using link
I am developing a Rails 3 application from which I want to be able
In Rails, I was able to do something similar to the following: respond_to do
Using Rails 3.2.2 and ruby 1.9.2 and I am not able to serve assets
I'm implementing a Rails application in which users will be able to store snippets
Using a restful resource in Rails, I would like to be able to insert
I was able to do the following in Rails 2.3.5 to access attributes that
Using the current rails 2 I want users to be able to create an
I'm using Paperclip with a Ruby on Rails to attach assets to a model,
I am trying to send email with attachments using Ruby on Rails. I followed

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.