久久久久久久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精品网 | 国产一区二区三区 | 亚洲一级av毛片 | 香蕉久久a毛片 | 国产一区二区欧美 | 国产精品视频久久 | 亚洲精品国产综合区久久久久久久 | 欧美一级片免费看 | 精品一区二区不卡 | 亚洲综合色丁香婷婷六月图片 | 91欧美精品成人综合在线观看 | 国产精品视屏 | 国产高潮av| 亚洲一区二区三区四区五区午夜 | 青青久久| 国产乱码精品1区2区3区 | 久久国产欧美日韩精品 | 久久久免费少妇高潮毛片 | 午夜激情一区 | 九七午夜剧场福利写真 | 成人三级av| 精品伦精品一区二区三区视频 | 一区二区精品在线 | www免费视频 | 国产成人精品免高潮在线观看 | 国产在线视频三区 | 欧美精品a∨在线观看不卡 欧美日韩中文字幕在线播放 | 成人国产精品免费观看 | 亚洲国产一区二区三区在线观看 | 精品免费国产一区二区三区四区介绍 | 丁香婷婷在线视频 | 日韩欧美亚洲 | 在线视频 中文字幕 |