我想在我的应用程序中发送一封带有 .PHP 文件作为附件的邮件:
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
mailViewController.mailComposeDelegate = self;
[mailViewController setSubject:@""];
[mailViewController setMessageBody:@"" isHTML:NO];
mailViewController.navigationBar.tintColor = [UIColor blackColor];
NSData *myData = [NSData dataWithContentsOfFile:[self getScriptPath]];
NSString *fileName = @"upload.php";
[mailViewController addAttachmentData:myData mimeType:@"text/html" fileName:fileName];
[self presentViewController:mailViewController animated:YES completion:nil];
[mailViewController release];
}
else
NSLog(@"Device is unable to send email in its current state.");
正在发送邮件,但没有附件!...