title: GMail won't open .txt attachment created by iPhone App, Depending on Size - I think There's a Bug in my MIME
body: <p>I have created aand sent a short email with a .txt attachment in an iPhone app.</p>
  
  <ol>
  <li><p>If the attachment is about 10 lines long, GMail opens it just fine. </p></li>
  <li><p>If it's more than 20 or so lines, GMail chokes - it won't open the attachment, download the attachment, or even forward the email.</p></li>
  <li><p>Also, if I send the same email to my colleague and he opens it with his Mac OS Mail client, everything works fine.</p></li>
  </ol>
  
  <p>For example, the following is the content of the text file (this length will open in GMail just fine): </p>
  
  <pre><code>ACCELEROMETER READINGS
  -0.0724487,-0.941833,-0.235458,2009-07-11 15:18:46 -0700
  -0.0724487,-0.941833,-0.271683,2009-07-11 15:18:47 -0700
  -0.0724487,-0.923721,-0.253571,2009-07-11 15:18:48 -0700
  -0.0543365,-0.923721,-0.326019,2009-07-11 15:18:49 -0700
  -0.0724487,-0.959946,-0.181122,2009-07-11 15:18:50 -0700
  -0.0543365,-0.923721,-0.253571,2009-07-11 15:18:51 -0700
  -0.108673,-0.923721,-0.380356,2009-07-11 15:18:52 -0700
  -0.0724487,-0.923721,-0.271683,2009-07-11 15:18:53 -0700
  
  GPS READINGS
  
  HEADING READINGS
  211.421,2009-07-11 15:18:46 -0700
  206.421,2009-07-11 15:18:49 -0700
  184.421,2009-07-11 15:18:50 -0700
  195.421,2009-07-11 15:18:51 -0700
  198.421,2009-07-11 15:18:53 -0700
  </code></pre>
  
  <p>If the file is twice this size, GMail can't deal ith it, but once again Mail can. So, what might be the problem? I created the email as follows:</p>
  
  <pre><code>SKPSMTPMessage *testMsg = [[SKPSMTPMessage alloc] init];
  testMsg.fromEmail = @"founders@gmail.com";
  testMsg.toEmail = @"andrewljohnson@trailbehind.com";
  testMsg.relayHost = @"smtp3.webfaction.com";
  testMsg.requiresAuth = YES;
  testMsg.login = @"andrewljohnson";
  testMsg.pass = @"********";
  testMsg.subject = @"iPhone Instrument Readings";
  testMsg.wantsSecure = YES; // smtp.gmail.com doesn't work without TLS!
  testMsg.delegate = self;
  
  NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/plain",kSKPSMTPPartContentTypeKey, @"Hey Kevin,\nHere are some GPS readings for you to filter.\n\nLove, \nTrailBehind",kSKPSMTPPartMessageKey,@"8bit",kSKPSMTPPartContentTransferEncodingKey,nil];
  NSData *fileData = [NSData dataWithContentsOfFile:fileName];    
  NSDictionary *attached = [NSDictionary dictionaryWithObjectsAndKeys:@"text/directory;\r\n\tx-unix-mode=0644;\r\n\tname=\"readings.txt\"",kSKPSMTPPartContentTypeKey, @"attachment;\r\n\tfilename=\"readings.txt\"",kSKPSMTPPartContentDispositionKey,[fileData encodeBase64ForData],kSKPSMTPPartMessageKey,@"base64",kSKPSMTPPartContentTransferEncodingKey,nil];
  
  testMsg.parts = [NSArray arrayWithObjects:plainPart,attached,nil];
  [testMsg send];
  </code></pre>