以下は、メールで添付ファイルを送信するための私のコードです。これはうまくいきます。メールを送信することはできますが、常にメールを受信するとは限りません。
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
// Set the subject of email
[picker setSubject:@"My data file"];
// Add email addresses
[picker setToRecipients:[NSArray arrayWithObjects:emailId, nil]];
// Fill out the email body text
NSString *emailBody = @"Hello, \n Please find the data from the iOS app in the attachments.\n\n Thank you.\nMy Team.";
// This is not an HTML formatted email
[picker setMessageBody:emailBody isHTML:NO];
// Create NSData object from file
NSData *exportFileData = [NSData dataWithContentsOfFile:filePath];
// Attach image data to the email
[picker addAttachmentData:exportFileData mimeType:@"text/csv" fileName: [self.CSVNameTextField text]];
// Show email view
if ([MFMailComposeViewController canSendMail]) {
[self presentModalViewController:picker animated:YES];
}