1
我正在使用MessageUI框架在我的应用程序中撰写电子邮件。我想为邮件正文设置HTML内容。将HTML内容设置为MFMailComposeViewController视图的邮件正文
所以我refered Mugunthkumar's blog和我编写如下,
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Hello from California!"];
// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"[email protected]"];
NSArray *ccRecipients = [NSArray arrayWithObjects:@"[email protected]", @"[email protected]", nil];
NSArray *bccRecipients = [NSArray arrayWithObject:@"[email protected]"];
[picker setToRecipients:toRecipients];
[picker setCcRecipients:ccRecipients];
[picker setBccRecipients:bccRecipients];
// Fill out the email body text
NSString *pageLink = @"http://mugunthkumar.com/mygreatapp"; // replace it with yours
NSString *iTunesLink = @"http://link-to-mygreatapp"; // replate it with yours
NSString *emailBody =
[NSString stringWithFormat:@"%@\n\n<h3>Sent from <a href = '%@'>MyGreatApp</a> on iPhone. <a href = '%@'>Download</a> yours from AppStore now!</h3>", @"title", pageLink, iTunesLink];
[picker setMessageBody:emailBody isHTML:YES];
[self presentModalViewController:picker animated:YES];
[picker release];
当我运行的应用程序,并转到电子邮件撰写看法,我得到下面的邮件正文,
我正在使用XCode4和iOS 4.3。 我看不到我的代码有任何问题。 但我需要将可点击的网址插入我的邮件正文。
请帮忙!!
非常感谢。现在,正文内容按我的意愿显示。 – chinthakad