Ios – Send outline as email using MFMailComposeViewController

emailiosiphoneiphone-sdk-3.0mfmailcomposeviewcontroller

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!

Best Answer

In my apps, I only put what is in between the body tags, i.e. NO

html    
head
body

tags. Just put the stuff you would normally put in between the body tags and it should work.