我想使用MFMailComposeViewController通过电子邮件发送文本大纲。我目前正在通过创建文档的HTML版本并将其设置为消息正文来实现此目的。这在MFMailComposeViewController中查看电子邮件时工作正常,但在接收端(MobileMail.app,GMail Webinterface,OSX Mail)。 app)格式化丢失。
这是我目前的代码:
- (IBAction)showMailController {
if (![MFMailComposeViewController canSendMail]) return;
MFMailComposeViewController *mailComposeViewController = [[MFMailComposeViewController alloc] init];
mailComposeViewController.mailComposeDelegate = self;
NSString *stringRepresentation = @"<html><head></head><body><ul><li>@grocery</li><ul><li>Milk</li><li>Cat food</li><li>Rice</li><li>Tofu</li></ul></ul></body></html>";
[mailComposeViewController setMessageBody:stringRepresentation isHTML:YES];
[self presentModalViewController:mailComposeViewController animated:YES];
[mailComposeViewController release];
}
我做错了吗?还有其他办法吗?
我还尝试使用手动缩进导出简单的文本大纲(我插入两个空格作为制表符不起作用),但文本编辑器不会将其识别为大纲。
NSMutableString *inset = [[NSMutableString alloc] init];
NSUInteger i;
for (i=0; i<insetCount;i++) {
[inset appendString:@" "];
}
NSMutableString *string = [[NSMutableString alloc] initWithString: [NSString stringWithFormat:@"%@%C ", inset, 0x2022]];
感谢您的帮助!
答案 0 :(得分:2)
在我的应用程序中,我只将身体标签之间的内容放入,即NO
html
head
body
标记。只需将通常放在身体标签之间的东西放在身体标签之间即可。