My PDF file appears in both UIWebView and the mail on screen on iphone as an attachment. When I send it to my email (using two different email carriers) it gets stripped out-no file attachment. I can send pdfs to these email accounts on my iphone and forward them ok so I don't think its my email provider but iOS that is stripping the file out??? I can attach images ok but NOT PDF files. Not sure where the issue is and how to find where the issue is occuring. Thanks!
My code:
-(void)doSendEmail :(NSString *)use_email :(NSString )amsg { if ([MFMailComposeViewController canSendMail]) { MFMailComposeViewController controller = [[MFMailComposeViewController alloc] init]; controller.mailComposeDelegate = self; [controller setToRecipients:[NSArray arrayWithObjects:use_email, nil]];
NSString *filen=self.filepath1;
NSString *pdfPath = [[NSBundle mainBundle] pathForResource:filen ofType:@"pdf"];
NSData *pdfData = [NSData dataWithContentsOfFile:pdfPath];
[controller addAttachmentData:pdfData mimeType:@"application/pdf" fileName:self.filename1]
}
//Set messages
[controller setSubject:self.subject];
[controller setMessageBody:amsg isHTML:NO];
//Display email for user to send
[self presentModalViewController:controller animated:YES];
[controller release];
}
}
-(void)mailComposeController:(MFMailComposeViewController*)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError*)error {
if ( (result == MFMailComposeResultSent) && (stat==4) ) {
billsent=1;
}
[self dismissModalViewControllerAnimated:YES];
}