使用 MFMailComposeViewController 将大纲作为电子邮件发送
我想使用 MFMailComposeViewController 通过电子邮件发送文本大纲。我目前正在通过创建文档的 HTML 版本并将其设置为消息正文来执行此操作。在 MFMailComposeViewController 中查看电子邮件时,这工作正常,但在接收端(MobileMail.app、GMail Webinterface、OSX Mail.应用程序)格式丢失。
这是我当前的代码:
- (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]];
感谢您的帮助!
I'd like to send a text outline via email using MFMailComposeViewController. I'm currently doing this by creating a HTML version of the document and setting this as the body of the message.This works fine when viewing the email in MFMailComposeViewController, but on the receiving end (MobileMail.app, GMail Webinterface, OSX Mail.app) the formatting is lost.
This is my current code:
- (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];
}
Am I doing something wrong? Is there an other way to do it?
I also tried exporting as simple text outline with manually indenting (I inserted two spaces as tab didn't work), but text editors don't recognize this as an outline.
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]];
Thank you for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我的应用程序中,我只放置正文标签之间的内容,即没有
标签。只需将您通常放入正文标签之间的内容即可,它应该可以工作。
In my apps, I only put what is in between the body tags, i.e. NO
tags. Just put the stuff you would normally put in between the body tags and it should work.