久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何使用 MFMailComposeViewController 在電子郵件正文中

How to add a image in email body using MFMailComposeViewController(如何使用 MFMailComposeViewController 在電子郵件正文中添加圖像)
本文介紹了如何使用 MFMailComposeViewController 在電子郵件正文中添加圖像的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我正在嘗試找出在電子郵件正文中添加圖像而不是在 ios 中作為附件添加的最佳方法.

I am trying to find out the best way to add an image inside the body of the email and not as attachment in ios.

1) Apple 提供了一個功能addAttachment",文檔說,要在內容中添加任何圖像,我們應該使用此功能,但我嘗試了該功能,并發送了一封郵件,我檢查了我的瀏覽器,它是作為附件接收的.

1) Apple has provided a function "addAttachment" and the doc says, to add any image in the content, we should use this function, but I tried that function, and sent an mail, I checked on my browser, it is recieved as an attachment.

2) 其次,許多博客都說要使用 base64 編碼, 但那也行不通,圖像被作為損壞的圖像發送.

2) Secondly, many blogs say to use base64 encoding, but that also wont work, image is sent as a broken one.

所以朋友們,請幫助我找到最好的解決方案.

So friends, please help me out to find the best available solution to do this.

問候蘭吉特

推薦答案

設置郵件格式為 HTML.此代碼在我的應用程序中運行良好.

Set email format as HTML. This code is woking fine in my app.

MFMailComposeViewController *emailDialog = [[MFMailComposeViewController alloc] init];

NSString *htmlMsg = @"<html><body><p>This is your message</p></body></html>";

NSData *jpegData = UIImageJPEGRepresentation(emailImage, 1.0);

NSString *fileName = @"test";
fileName = [fileName stringByAppendingPathExtension:@"jpeg"];
[emailDialog addAttachmentData:jpegData mimeType:@"image/jpeg" fileName:fileName];

emailDialog setSubject:@"email subject"];
[emailDialog setMessageBody:htmlMsg isHTML:YES];


[self presentModalViewController:emailDialog animated:YES];
[emailDialog release];

斯威夫特 5

import MessageUI

    func composeMail() {

        let mailComposeVC = MFMailComposeViewController()

        mailComposeVC.addAttachmentData(UIImage(named: "emailImage")!.jpegData(compressionQuality: CGFloat(1.0))!, mimeType: "image/jpeg", fileName:  "test.jpeg")

        mailComposeVC.setSubject("Email Subject")

        mailComposeVC.setMessageBody("<html><body><p>This is your message</p></body></html>", isHTML: true)

        self.present(mailComposeVC, animated: true, completion: nil)
    }

這篇關于如何使用 MFMailComposeViewController 在電子郵件正文中添加圖像的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Using Instruments to test an iOS app without having source code to the application(在沒有應用程序源代碼的情況下使用 Instruments 測試 iOS 應用程序)
KIF: How to auto-run/stress test an iOS app to find the cause of a rare UI bug?(KIF:如何自動運行/壓力測試 iOS 應用程序以找出罕見 UI 錯誤的原因?)
Can#39;t change target membership visibility in Xcode 4.5(無法更改 Xcode 4.5 中的目標成員身份可見性)
UITableView: Handle cell selection in a mixed cell table view static and dynamic cells(UITableView:在混合單元格表視圖靜態和動態單元格中處理單元格選擇)
How to remove Address Bar in Safari in iOS?(如何在 iOS 中刪除 Safari 中的地址欄?)
iOS 5 SDK is gone after upgrade to Xcode 4.5(升級到 Xcode 4.5 后,iOS 5 SDK 消失了)
主站蜘蛛池模板: 午夜免费网站 | 亚洲视频精品在线 | 亚洲一区二区视频 | 国产三级一区二区 | 一级特黄视频 | 亚洲少妇综合网 | 国产污视频在线 | 99热激情 | 啪啪网页 | 亚洲成人www | 国产精品免费观看 | 视频在线一区二区 | 国产精品网址 | 亚洲视频免费在线观看 | 999精品视频 | 久久男女视频 | 国产免费视频在线 | 91久久精品 | 精品九九在线 | 在线精品一区二区三区 | 久久精品综合网 | 欧美综合在线视频 | 天天干天天爱天天操 | 国产精品网页 | 国产视频不卡一区 | 亚洲一二视频 | 久久久久久精 | 午夜国产精品视频 | 午夜精品视频在线观看 | 国产高清精品一区二区三区 | 欧产日产国产精品v | 国产午夜一级 | 亚洲国产成人久久久 | 91亚洲国产亚洲国产 | 亚洲一区视频在线 | 精品国产一区久久 | 精品福利在线 | 欧美成人一区二区三区 | 精品国产鲁一鲁一区二区张丽 | 欧美大片久久久 | 精品一区二区三区在线观看国产 |