如何在应用程序内的电子邮件中以表格数据的形式发送图像以及文本?

请帮助并提出建议。谢谢。

最佳答案

- (void)sendMailWithImage:(UIImage *)image
{
if([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
if(mailController!=nil) {
mailController.mailComposeDelegate = self;
NSData *imageData = UIImagePNGRepresentation(image);
[mailController addAttachmentData:imageData mimeType:@"image/png" fileName:@"MyImageName"];
[mailController setSubject:yourSubject];
[mailController setMessageBody:yourBody isHTML:NO];
[self presentModalViewController:mailController animated:YES];
[mailController release];
}
else
{
//Do something like show an alert
}
}

希望这可以帮助

10-07 22:41