Tag: 电子邮件附件

为什么MFMailComposeViewController返回MFMailComposeResultFailed?

我在我的应用程序面临一个奇怪的问题,我需要你的帮助! 我正在使用MFMailComposeViewController发送附件数据的电子邮件。 附件可以是PDF,CSV或XLS文件。 ZIP文件也可以添加到邮件中。 在大多数情况下,一切正常,但有时(实际上很常见),当附件是一个XLS和ZIP添加,我收到多个内存警告,composer php返回MFMailComposeResultFailed,有一个错误,根本没有帮助(只说代码错误1,“操作无法完成(MFMailComposeErrorDomain错误1.)”)。 我的问题是为什么这样做? 我假设内存警告告诉我一些pipe理不善,但我无法弄清楚什么… 这是我发送电子邮件的代码 -(void) sendMail { MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; [self prepareMailPicker:picker]; NSString *filePath = [self getFilePath:pType]; NSString *zipFile = [self getZipPath]; NSString *mimeType; int userPhoto = [User getCSVPhoto]; switch (pType) { case EPDF: mimeType = @"application/pdf"; userPhoto = [User getPDFPhoto]; break; case ECSV: mimeType = @"text/csv"; […]

将.txt附加到MFMailComposeViewController

我有一个.txt文件存储在文档文件夹中,我想通过MFMailComposeViewController发送下一代码在-sendEmail方法的主体: NSData *txtData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"dataBase" ofType:@"txt"]]; [mail addAttachmentData:txtData mimeType:@"text/plain" fileName:[NSString stringWithFormat:@"dataBase.txt"]]; 当邮件编辑器出现时,我可以在邮件正文中看到附件,但是我收到这封没有附件的邮件。 也许这是错误的.txt附件的MIMEtypes或此代码的错误? 谢谢

使用Swift实现应用内电子邮件失败

我想用swift来实现应用内电子邮件。 当我点击button时,popup电子邮件窗口。 但是,我无法发送我的电子邮件。 而且,当我点击取消 – 删除草稿后,我不能回到原来的画面。 import UIkit import MessageUI class Information : UIViewController, MFMailComposeViewControllerDelegate{ var myMail: MFMailComposeViewController! @IBAction func sendReport(sender : AnyObject) { if(MFMailComposeViewController.canSendMail()){ myMail = MFMailComposeViewController() //myMail.mailComposeDelegate // set the subject myMail.setSubject("My report") //To recipients var toRecipients = ["lipeilin@gatech.edu"] myMail.setToRecipients(toRecipients) //CC recipients var ccRecipients = ["tzhang85@gatech.edu"] myMail.setCcRecipients(ccRecipients) //CC recipients var bccRecipients = ["tzhang85@gatech.edu"] […]

将照片附加到我的iPhone应用程序的电子邮件

我有一个iPhone应用程序,从应用程序内置的相册中挑选照片。 现在我想添加一个共享button,通过电子邮件分享这张照片,我可以附上一个现有的照片通过这个代码: MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self; [picker setSubject:@""]; // Set up recipients NSArray *toRecipients = [NSArray arrayWithObject:@""]; [picker setToRecipients:toRecipients]; // Attach an image to the email NSString *path = [[NSBundle mainBundle] pathForResource:@"project existing photo" ofType:@"jpg"]; NSData *myData = [NSData dataWithContentsOfFile:path]; [picker addAttachmentData:myData mimeType:@"image/jpeg" fileName:@"photo name"]; // Fill out the email […]

我如何使用UIActivityItemProvider发送带有UIActivityViewController附件的电子邮件?

我想通过电子邮件附件使用UIActivityItemProvider从我的应用程序共享文件。 我还需要填写电子邮件的主题行,并指定附件的名称与设备上存储的文件的名称不同。 这是我正在使用的代码。 问题是电子邮件中缺less附件。 @interface ItemProvider:UIActivityItemProvider @property (nonatomic, strong) NSURL *filepath; @property (nonatomic, strong) NSString *emailBody; @property (nonatomic, strong) NSString *emailSubject; @end @implementation ItemProvider – (id)initWithPlaceholderItem:(id)placeholderItem { //Initializes and returns a provider object with the specified placeholder data return [super initWithPlaceholderItem:placeholderItem]; } – (id)item { //Generates and returns the actual data object return [NSDictionary dictionary]; […]

PDF格式的电子邮件附件在iOS设备

我想附上pdf作为电子邮件附件创build。 我用下面的教程在iOS设备上创buildPDF。 下载的pdf可以在这个path查看:/用户/“用户名”/库/应用程序支持/ iPhone模拟器/“您的应用程序目录”。 我还没有尝试在ios设备上运行这个,但我需要附加它作为一个电子邮件。 链接教程是: http : //www.ioslearner.com/generate-pdf-programmatically-iphoneipad/ 任何build议。