如何使用默认邮件编辑器将文件附加到邮件

时间:2010-10-19 16:24:29

标签: ipad email email-attachments

我有一些带有一些数据的文件,我想把这个文件附加到邮件中,我正在使用默认的邮件编写器......

任何想法如何在发送给收件人之前将文件附加到邮件....

提前致谢....

2 个答案:

答案 0 :(得分:1)

带有附加图像的示例:

NSData *myData = UIImagePNGRepresentation(myImage);
[mailComposer addAttachmentData:myData mimeType:@"image/png" fileName:@"MyImage"];

答案 1 :(得分:0)

NSString * path = [[NSBundle mainBundle] pathForResource:@“bg”ofType:@“jpg”];

NSData *myData = [NSData dataWithContentsOfFile:path];

[controller addAttachmentData:myData mimeType:@"image/jpg" fileName:@"Attachment-1"];
[self presentModalViewController:controller animated:YES];