MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self;
[picker setMessageBody:@"Invoice Report Pdf File" isHTML:NO];
NSMutableData *pdfData =[NSMutableData dataWithContentsOfFile:filePath];
[picker addAttachmentData:pdfData mimeType:@"application/pdf" fileName:self.pdfName];
Change mime type according my code, it will help you.
NSMutableData *pdfData = [NSMutableData data]; UIGraphicsBeginPDFContextToData(pdfData, bounds, nil);
Then at some point in the future you'll need to pass that pdfData
to the MFMailComposeViewController
.
MFMailComposeViewController *vc = [[[MFMailComposeViewController alloc] init] autorelease]; [vc setSubject:@"my pdf"]; [vc addAttachmentData:pdfData mimeType:@"image/pdf" fileName:@"SomeFile.pdf"];