send an HTML formatted email using MFMailComposeViewController

♀尐吖头ヾ 提交于 2019-12-18 12:50:08

问题


I am formatting a mail with HTML content and sending it using MFMailComposeViewController.But on the receiver side mail is not reaching in HTML format.Only Plain text is visible.How could I resolve this issue.Thanks in advance.


回答1:


Be sure to set the message body using the following lines:

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
NSString *emailBody = @"<p><b>Hello World</b></p>";                         
[picker setMessageBody:emailBody isHTML:YES];



回答2:


Even if you set isHTML param to YES, your message body can be sent as plain/text if the message body can be represented as such.

In my case adding a link in the message body helped. Bold formatting with tags works too. Tricky!

Tested on iPod 1G 3.1.3.



来源:https://stackoverflow.com/questions/2094879/send-an-html-formatted-email-using-mfmailcomposeviewcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!