iphone - 使用 MFMailComposeViewController 将大纲作为电子邮件发送

标签 iphone ios email iphone-sdk-3.0 mfmailcomposeviewcontroller

我想使用 MFMailComposeViewController 通过电子邮件发送文本大纲。我目前正在通过创建文档的 HTML 版本并将其设置为邮件正文来执行此操作。这在 MFMailComposeViewController 中查看电子邮件时效果很好,但在接收端(MobileMail.app、GMail Web 界面、OSX 邮件。 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]];

感谢您的帮助!

最佳答案

在我的应用程序中,我只将 body 标签之间的内容放在一起,即 NO

html    
head
body

标签。只需将您通常会放在 body 标签之间的东西放在一起,它就会起作用。

关于iphone - 使用 MFMailComposeViewController 将大纲作为电子邮件发送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1465421/

相关文章:

iphone - 使用样式表时 TTThumbsViewController 不显示缩略图。

iphone - 如何嵌入一个小的相机预览,然后将整个截图图像保存在iphone中

iphone - MapKit - 本地图放大时让路线沿着街道

android - 我可以基于 Python 代码为 Android 和/或 iOS 创建可执行代码吗?

android - 如何获取设备中存储的用户自己的电子邮件地址?

android - 在没有用户交互的情况下发送电子邮件android

ios - UNCalendarNotificationTrigger 每小时触发器返回错误的触发日期

iphone - glDrawArrays 有时绘制黑色

ios - Swift:IAP updatedTransactions 未在 .Purchased 上调用

email - 使用 STARTTLS 从 Office365 发送电子邮件失败