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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:39:49+00:00 2026-06-03T06:39:49+00:00

Alright. I thought this problem had something to do with my rails app, but

  • 0

Alright. I thought this problem had something to do with my rails app, but it seems to have to do with the deeper workings of email attachments.

I have to send out a csv file from my rails app to a warehouse that fulfills orders places in my store. The warehouse has a format for the CSV, and ironically the header line of the CSV file is super long (1000+ characters).

I was getting a line break in the header line of the csv file when I received the test emails and couldn’t figure out what put it there. However, some googling has finally showed the reason: attached files have a line character limit of 1000. Why? I don’t know. It seems ridiculous, but I still have to send this csv file somehow.

I tried manually setting the MIME type of the attachment to text/csv, but that was no help. Does anybody know how to solve this problem?

Some relevant google results : http://www.google.com/search?client=safari&rls=en&q=csv+wrapped+990&ie=UTF-8&oe=UTF-8

update

I’ve tried encoding the attachment in base64 like so:

    attachments['205.csv'] = {:data=> ActiveSupport::Base64.encode64(@string), :encoding => 'base64', :mime_type => 'text/csv'}

That doesn’t seem to have made a difference. I’m receiving the email with a me.com account via Sparrow for Mac. I’ll try using gmail’s web interface.

  • 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-03T06:39:50+00:00Added an answer on June 3, 2026 at 6:39 am

    This seems to be because the SendGrid mail server is modifying the attachment content. If you send an attachment with a plain text storage mime type (e.g text/csv) it will wrap the content every 990 characters, as you observed. I think this is related to RFC 2045/821:

    1. Content-Transfer-Encoding Header Field

      Many media types which could be usefully transported via email are
      represented, in their "natural" format, as 8bit character or binary
      data. Such data cannot be transmitted over some transfer protocols.
      For example, RFC 821 (SMTP) restricts mail messages to 7bit US-ASCII
      data with lines no longer than 1000 characters including any trailing
      CRLF line separator.

      It is necessary, therefore, to define a standard mechanism for
      encoding such data into a 7bit short line format. Proper labelling
      of unencoded material in less restrictive formats for direct use over
      less restrictive transports is also desireable. This document
      specifies that such encodings will be indicated by a new "Content-
      Transfer-Encoding" header field. This field has not been defined by
      any previous standard.

    If you send the attachment using base64 encoding instead of the default 7-bit the attachment remains unchanged (no added line breaks):

    attachments['file.csv']= { :data=> ActiveSupport::Base64.encode64(@string), :encoding => 'base64' }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, I thought I had this whole setTimeout thing perfect but I seem to
Alright so we had a problem recently In reporting services some of the String
Alright, I'll try to explain this the best I can. I have an iPhone
Alright, I thought I understood generics pretty well, but for some reason I can't
Alright, so this is something really basic, and I know that when someone tells
Alright thought I would throw this one out there for the crowd to think
Alright This is What i have: I'm playing around with authengine by scotch and
Alright, while designing a site, I came across a thought... I have a few
Alright I am still learning my functions in php but this particular piece of
Alright, I have been breaking my head over this one for more than a

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.