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

  • Home
  • SEARCH
  • 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 7736941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:52:22+00:00 2026-06-01T07:52:22+00:00

I am using cloudmailin to receive emails that are sent to a specific address.

  • 0

I am using cloudmailin to receive emails that are sent to a specific address. I am trying a simple scenario where I send an email with an attachment from Mail.app. When I receive the post in my application I create a mail object.

When I create the mail object, the attachments are empty.

mail_str = 
"Received: (qmail 16453 invoked from network); 2 Apr 2012 14:27:29 -0000\r\nReceived: from unknown (71.170.102.226)\r\n  by smtpauth20.prod.mesa1.secureserver.net (64.202.165.36) with ESMTP; 02 Apr 2012 14:27:29 -0000\r\nFrom: Jake Dempsey <jake@direct2mfg.com>\r\nContent-Type: multipart/mixed; boundary=\"Apple-Mail=_8E1F0992-1DAA-409B-BC73-74747FFDFA98\"\r\nSubject: inv\r\nDate: Mon, 2 Apr 2012 09:27:28 -0500\r\nMessage-Id: <EB899F47-7E1F-4853-AE17-17290BF7B4F8@direct2mfg.com>\r\nTo: 4511bea79e86da90d6d2@cloudmailin.net\r\nMime-Version: 1.0 (Apple Message framework v1257)\r\nX-Mailer: Apple Mail (2.1257)\r\n\r\n\r\n--Apple-Mail=_8E1F0992-1DAA-409B-BC73-74747FFDFA98\r\nContent-Disposition: attachment;\r\nfilename=test.csv\r\nContent-Type: text/csv;\r\nname=\"test.csv\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\nRemove Itesm,Item ID,Short Desc,Long Desc,Segment,Item =\r\nClass,Cost,MSRP,Stock UOM, Unit Vol,Unit Weight,Unit Height,Unit =\r\nLength,Unit Width=0Dno,1, super short, super long long, Casual, =\r\nCasual,1,3,Each, , , , , =0Dno,2, super short, super long long, Casual, =\r\nCasual,1,3,Each, , , , , =0Dno,3, super short, super long long, Casual, =\r\nCasual,1,3,Each, , , , , =0Dno,4, super short, super long long, Casual, =\r\nCasual,1,3,Each, , , , , =0Dno,5, super short, super long long, Casual, =\r\nCasual,1,3,Each, , , , , =0Dno,6, super short, super long long, Casual, =\r\nCasual,1,3,Each, , , , , =0Dno,7, super short, super long long, Casual, =\r\nCasual,1,3,Each, , , , , =0Dno,8, super short, super long long, Casual, =\r\nCasual,1,3,Each, , , , , =0D=\r\n\r\n--Apple-Mail=_8E1F0992-1DAA-409B-BC73-74747FFDFA98--\r\n"

mail_obj = Mail.new mail_str
puts mail_obj.attachments.size #should be 1

If I send an email through other clients, I am able to create a mail_obj and the attachments size is 1.

I am using rails 3.1.3

  • 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-01T07:52:23+00:00Added an answer on June 1, 2026 at 7:52 am

    We had some issues with the mail gem always finding the correct attachments and finding nested attachments. In the end we ended up creating a method to iterate through each of the message parts and recursively extract any attachments.

    for example (warning this isn’t the actual method that we used so it might not be perfect)

    def parse_attachment(mail, attachments=[])
      mail.parts.each do |part|
        if part.attachment?
          attachments << part
        else
          if part.parts && part.parts.length > 0
            parse_attachment(part, attachments)
          end
        end
      end
      return attachments
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to receive incoming emails as multipart-formdata via a POST request from Cloudmailin.
Using php/html, I want to retrieve email addresses (plus other information) from MySQL and
using the arcsynthesis opengl tutorial and I'm trying to build the unofficial sdk that
I have a website that receives incoming emails via cloudmailin, adds the content to
Using Nunit, I want to be able to write a test fixture that will
Using top it's easy to identify processes that are hogging memory and cpu, but
Using linq2sql I'm trying to take the string in txtOilChange and update the oilChange
Using the navigator.geolocation object in JavaScript. Trying to establish accurate ranges, but wondering exactly
Using Rails 3.2.0 with haml, sass and coffeescript: Basically I am trying to disable
Using mercurial, I've run into an odd problem where a line from one committer

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.