我的应用程序中嵌入了一个 HTML,我希望能够在应用程序中通过电子邮件发送它。我设置了以下代码,它将通过电子邮件发送文本,但不附加嵌入其中的图像。我相信这是由于未正确设置 baseURL,但我不确定如何为 emailBody 执行此操作。有什么想法吗?
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"Thanks" ofType:@"html"];
NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"A prayer gift of thanks to you"];
// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"friend@example.com"];
[picker setToRecipients:toRecipients];
// Fill out the email body text
NSString *emailBody = htmlString;
[picker setMessageBody:emailBody isHTML:YES];