Reputation: 2200
In my iPhone app, I have a view where I am showing the names of files stored in the Documents directory.
These files are downloaded from a server, and now I want to implement an email function into my application.
My questions are:
Upvotes: 1
Views: 413
Reputation: 7148
Assuming you're using the stock MFMailComposeViewController, you can add more than one attachment using addAttachmentData:mimeType:fileName:
. You have to attach the raw data, so you'll need to fetch the file from disk and get an NSData
representation. Here's an example of how to add to add a UIImage
as an attachment:
MFMailComposeViewController *mvc = [[MFMailComposeViewController alloc] init];
mvc.mailComposeDelegate = self;
[mvc setSubject:@"My Subject"];
[mvc setMessageBody:@"My Message Body" isHTML:NO];
NSData *imageData = UIImageJPEGRepresentation(myImage, 1);
[mvc addAttachmentData:imageData mimeType:@"image/jpeg" fileName:@"image.jpg"];
[self presentModalViewController:mvc animated:YES];
[mvc release];
Upvotes: 3