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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:38:41+00:00 2026-06-02T00:38:41+00:00

I am not sure why the email that I send via ActionMailer with an

  • 0

I am not sure why the email that I send via ActionMailer with an attachment doesn’t show me the attachment instead the contents of the attachment is just shown / output into the email.

class MyMailer < ActionMailer::Base
  default :from => "email@email.com"

  def test_email()
    attachments['testresult1.html'] = {
      :filename => 'testresult1.html',
      :body => File.read('C:\\testresult1.html')
    }

  mail(:to => 'email@email.com',
    :subject => 'Cool great message'
  )
  end
end

The output of the email looks like this

Date: Tue, 17 Apr 2012 14:11:52 +1000
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8;
filename=testresult1.html
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=testresult1.html
filename: testresult1.html
Content-ID: <4f8ced883c0d9_1b1c30b580813e@PC-049.mail>

and then the whole contents of the HTML file/attachment.

I’d expect the HTML file to be attached to the email as it would be attached to a normal email and I should be able to double click on the attachment and open it in a browser.

Email Client = Microsoft Outlook
Connection = SMTP
Rails = 3.2.1
ActionMailer = 3.2.1
Mail = 2.4.4
  • 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-02T00:38:42+00:00Added an answer on June 2, 2026 at 12:38 am

    You should try adding a body key to #mail.

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

Sidebar

Related Questions

Not sure if im just being stupid or something but here goes i work
I'm using System.Net.Mail to send an email message and want to make sure it
I have an APEX class that is used to send an email out each
Im trying to send a Docx file via this form that I made, the
Trying to have a PHP script send an email that contains two images that
I have a SQL Server 2008 procedure that sends email via sp_send_dbmail. I'm using
I'm trying to send email via google apps from my asp.net app and am
I'm not sure where to put some methods. Let's say I want to send
I'm not sure how to categorize this question, so let me just explain what
Not sure whats going on here, or what could be the integer in this

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.