I successfully created a txt file (i.e. the file exists and opens), I would like to attach it to an email that I am successfully generating (i.e. the email opens and I can put text into the email etc. and send it). Here is the code I have now for performing the attachment:
// Attach a file to the email
NSString *path = [self dataFilePath:(@"myFile.txt")];
NSData *myData = [NSData dataWithContentsOfFile:path];
[picker addAttachmentData:myData mimeType:@"text/plain" fileName:@"myFile"];
The dataFilePath is a method I use to get the path for a file, it works fine as I use it often. The above code puts a < br/ > < br/ >, then has the text from the text file with a few more < br/ > < br/ > ..breaks in there... so this doesn't actually attach the file it pastes it in the email text... I would like to attach the file.
I copied/modified this code from other posts on stackoverflow and I'm having a hard time finding info on apple's site. Note: I'm not sure what the mimeType is for a txt file, as their website (www.iana.org) doesn't denote a txt...???
Update: Changed to updated code, and Thanks for confirming that "plain" was the correct choice for the mimeType.