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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:40:32+00:00 2026-05-12T07:40:32+00:00

I am using the following dictionary to create a MIME header, to send an

  • 0

I am using the following dictionary to create a MIME header, to send an email that attaches a text file. It produces the email below the code. Why is everything garbled? Any MIME experts out there?

Also, the answer is not as simple as you are Base64 encoding it. If I change it from “inline” to “attachment,” the email attachment is corrupt when sent to web Gmail, but the file is ok and can be opened fine if it goes through GMail, but is opened by Mail on a Mac. Also, if the text file is very small, it works fine on GMail too.

Here is a previous formulation of this unanswered question. I have changed the code a bit in this example, to avoid what I think might be red herrings: GMail won't open .txt attachment created by iPhone App, Depending on Size – I think There's a Bug in my MIME

NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:
  @"text/plain", kSKPSMTPPartContentTypeKey,
  @"Hey Kevin,\nHere are some gps readings for you to filter.\nLove,\nTrailBehind", kSKPSMTPPartMessageKey,
  @"8bit", kSKPSMTPPartContentTransferEncodingKey, nil];

NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
NSString *gpsFilePath = [[@"/tracks/" stringByAppendingString:[track title]] stringByAppendingString:@"/accelerometerReadings.txt"];
gpsFilePath = [[paths objectAtIndex:0] stringByAppendingString: gpsFilePath];

NSData *fileData = [NSData dataWithContentsOfFile:gpsFilePath];
NSDictionary *attached = [NSDictionary dictionaryWithObjectsAndKeys:
  @"text/plain;", kSKPSMTPPartContentTypeKey,
  @"inline;\r\tfilename=\"accelerometerReadings.txt\"", kSKPSMTPPartContentDispositionKey,
  [fileData encodeBase64ForData], kSKPSMTPPartMessageKey,
  @"base64", kSKPSMTPPartContentTransferEncodingKey, nil];

testMsg.parts = [NSArray arrayWithObjects:plainPart, attached, nil];
[testMsg send];

THE EMAIL

--SKPSMTPMessage--Separator--Delimiter
Content-Type: text/plain
Content-Transfer-Encoding: 8bit

Hey Kevin,
Here are some gps readings for you to filter.
Love,
TrailBehind
--SKPSMTPMessage--Separator--Delimiter
Content-Disposition: attachment;    filename="track.gpx"
Content-Type: text/plain;
Content-Transfer-Encoding: base64

PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/PjxncHggeG1sbnM9Imh0dHA6Ly93d3cudG9wb2dyYWZpeC5jb20vR1BYLzEvMSIgY3JlYXRvcj0iVHJhaWxCZWhpbmQiIHZlcnNpb249IjEuMSIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSIgeHNpOnNjaGVtYUxvY2F0aW9uPSJodHRwOi8vd3d3LnRvcG9ncmFmaXguY29tL0dQWC8xLzEgaHR0cDovL3d3dy50b3BvZ3JhZml4LmNvbS9HUFgvMS8xL2dweC54eHNkIj4KICA8dHJrPgogICAgPG5hbWU+TXkgVHJhY2sgLSAwNy0yMi0yMDA5IDA2OjQxU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zMTYyMTUiIGxvbj0iLTEyMC4xNjcyOTciPjwvdHJrcHQ+CgogICAgICA8dHJrcHQgbGF0PSIzOS4zMTYxOTQiIGxvbj0iLTEyMC4xNjcxODEiPjwvdHJrcHQ+CgogICAgICA8dHJrcHQgbGF0PSIzOS4zMTYwNzciIGxvbj0iLTEyMC4xNjcyNTMiPjwvdHJrcHQ+CgogICAgICA8dHJrcHQgbGF0PSIzOS4zMTYwMzIiIGxvbj0iLTEyMC4xNjcyMzQiPjwvdHJrcHQ+CgogICAgICA8dHJrcHQgbGF0PSIzOS4zMTU5ODMiIGxvbj0iLTEyMC4xNjcxOTEiPjwvdHJrcHQ+CgogICAgPC90cmtzZWc+CiAgPC90cms+CjwvZ3B4Pgo=
--SKPSMTPMessage--Separator--Delimiter

--SKPSMTPMessage--Separator--Delimiter--
  • 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-12T07:40:33+00:00Added an answer on May 12, 2026 at 7:40 am

    If that’s what your Base64 output looks like, its wrong; it should be wrapped to 76-character lines for email. Also, it looks like something added spaces (probably due to it not being wrapped)

    Also, are you setting content-transfer-encoding? I see the lines setting the content-type and the content-disposition, but without the content-transfer-encoding, you’ll get the default (7bit)… which will just show the encoded MIME. Which is what’s happening.

    I suggest checking your raw message output (e.g., “show original” in gmail) against RFC 2045 §6 and §6.8 in particular.

    If this doesn’t solve your question, please edit to include the raw message.

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

Sidebar

Related Questions

I'm using the following JavaScript code: <script language=JavaScript1.2 type=text/javascript> function CreateBookmarkLink(title, url) { if
I am using following PHP code to connect to MS Access database: $odb_conn =
Using the following code I get a nice formatted string: Request.QueryString.ToString Gives me something
I'm using the following code to query a database from my jsp, but I'd
I'm using the following method to send mail from Python using SMTP. Is it
Currently I'm using the following class as my key for a Dictionary collection of
Using the following query and results, I'm looking for the most recent entry where
Using the following query: SELECT pe.prodtree_element_name_l, MAX(rs.resource_value) AS resource_value FROM prodtree_element pe LEFT JOIN
I am currently using the following command to upload my site content: scp -r
I'm using the following html to load dojo from Google's hosting. <script src=http://www.google.com/jsapi></script> <script

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.