Yes it is possible.
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *WritableDBPath= [documentsDirectory stringByAppendingPathComponent:kFilename];
NSData *data = [NSData dataWithContentsOfMappedFile:WritableDBPath];
[picker addAttachmentData:data mimeType:@"text/richtext" fileName:@"/abc.zip"];
[picker setSubject:@"Database"];
[picker setMessageBody:@"Database testing" isHTML:YES];
[self presentModalViewController:picker animated:YES];
You can choose the path to the file, the file name of your choice. Please check the mime type if it does not work.
:)
source
share