iphone - 发送多个文本和图像到电子邮件正文

标签 iphone ios objective-c mfmailcomposeviewcontroller

我正在使用setMessageBody通过我的应用程序发送电子邮件,我可以将正文设置为我的邮件,但我的要求是我要发送多个图像和文本

使用addAttachmentData两次,我可以发送两个图像,但是我想发送文本图像。

在gmail中无法使用HTML
可以这样发送吗?

MFMailComposeViewController *mailView= [[MFMailComposeViewController alloc] init];
            mailView.mailComposeDelegate=self;
            [mailView setSubject:@"ABCD"];
              [mailView setMessageBody:@"Hai" isHTML:NO];
            UIImage * emailimage = [UIImage imageNamed:@"Iconpaid.png"];
            NSData * emaildata = UIImageJPEGRepresentation(emailimage, 1.0);

          [mailView addAttachmentData:emaildata mimeType:@"image/png" fileName:@"File"];

           // Here i want to add text

          [mailView addAttachmentData:emaildata mimeType:@"image/png" fileName:@"File"];
            [mailView setToRecipients:[NSArray arrayWithObject:@""]]; //[NSArray arrayWithObject:appDelegate.mechanicEmail]];
            [self presentModalViewController:mailView animated:YES];

最佳答案

[mailView addAttachmentData:emaildata mimeType:@"image/png" fileName:@"File"];

使用此行附加您想要添加的图像数量,例如
[mailView setMessageBody:@"Hai" isHTML:YES];

设置isHTML = YES,以便您将正文中的所有图像而不是作为附件(在嵌入的正文中)

关于iphone - 发送多个文本和图像到电子邮件正文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16494279/

相关文章:

iphone - UIAlertViewDelegate clickedButtonAtIndex : usefulness?

iphone - 带有静态 header 的 uiwebview (mobilesafari)

ios - 如何链接 Observables 并为错误处理创建一个公共(public)位置

ios - 添加到 UIButton 的 UIButton 不响应选择器

objective-c - 指定初始化器,请澄清。

iphone - Xcode,某些子类没有调试符号

iphone - 有没有可以修改iphone系统时间的api?

iphone - 大图像导致 xCode 崩溃

ios - Facebook 的 invitable_friends 端点导致好友丢失

ios - 内容未显示在 UITableViewCell 上