The following code will output your HTML from your application and into the Apple Mail application. The documentation doesn't give you much help with this, so part of the question is which Apple apps park on cardboard and then remodel it. This solution builds on an earlier https://stackoverflow.com/a/16677664/ ... - follow the links where there is more background.
NSLog(@"Place HTML on the pasteboard"); UIPasteboard* pasteboard = [UIPasteboard generalPasteboard]; NSString *htmlType = @"Apple Web Archive pasteboard type"; // example html string NSString* htmlString = @"<p style=\"color:gray\"> <a href=@\"http://itunes.apple.com/gb/app/paragraft/id412998778?mt=8\">Paragraft</a><br><em>Less than a word processor, more than plain text</em>"; NSMutableDictionary *resourceDictionary = [NSMutableDictionary dictionary]; [resourceDictionary setObject:[htmlString dataUsingEncoding:NSUTF8StringEncoding] forKey:@"WebResourceData"]; [resourceDictionary setObject:@"" forKey:@"WebResourceFrameName"]; [resourceDictionary setObject:@"text/html" forKey:@"WebResourceMIMEType"]; [resourceDictionary setObject:@"UTF-8" forKey:@"WebResourceTextEncodingName"]; [resourceDictionary setObject:@"about:blank" forKey:@"WebResourceURL"]; NSDictionary *containerDictionary = [NSDictionary dictionaryWithObjectsAndKeys:resourceDictionary, @"WebMainResource", nil]; NSDictionary *htmlItem = [NSDictionary dictionaryWithObjectsAndKeys:containerDictionary,htmlType,nil]; [pasteboard setItems: [NSArray arrayWithObjects: htmlItem, nil]]; // This approach draws on the blog post and comments at: // http://mcmurrym.wordpress.com/2010/08/13/pasting-simplehtml-into-the-mail-app-ios/
Obliquely
source share