EDIT: What you're about to read DOESN'T work (yet)! Check my other post on Base64 Encoding your image which DOES work.
This one looks just fine in the email composition window, but the actual sent email doesn't include the pics (I just tested it on my phone). I mistakenly thought that the mail app would base64 encode the images itself (It does so for attached images). And, although it's a pain, you can get an email on the iPhone to insert multiple "flowed" inline images by going to your image folder, copying an image to the clipboard, going to your email, and pasting it where you want. You can write more text, save the email as a draft, and repeat the process with more images pasted into the same email. Send the email to yourself, then open it on your computer with Text Edit. You'll be able to see exactly the formatting that the email takes (including the base64 encoded images).
What strangely happens with my code below is that the text makes it into the email, but the images just disappear entirely (not even a dangling "broken" reference to them :-/ ). This makes me doubt that linking to the images on an external server would work. I'm going to continue working on this... I'm wondering if it will behave differently if I have the email launch in the mail app outside of my program. I'll keep coming back to update this as I figure more out... it just seems like this should be easier than Apple makes it :-/
This code is written for image files that you'd store in your "Documents" directory (so your app would have to be creating images that are stored there, and HTML code that references those images. For images that you have stored in the app bundle, use [[NSBundle mainBundle] resourcePath] for the initial path to the images).
- (void)createEmailWithInlineImages {
//get app Documents directory
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsPath = [paths objectAtIndex:0];
//make spaces HTML friendly
documentsPath = [documentsPath stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
//make forward-slash into double-forward-slash for HTML file-URL comapatibility
documentsPath = [documentsPath stringByReplacingOccurrencesOfString:@"/" withString:@"//"];
//get the name for your image into the string however your app works
//create a string formatted like a literal HTML URL to the image, e.g.
//file:///myiPhoneFileSystemPath//MyApplication//MyApplicationDirectories//Documents//imageName.jpg
NSString *myHTMLImageName = @"myHTMLImage.jpg";
NSString *imagePath = [NSString stringWithFormat:@"file:///%@//%@",documentsPath,myHTMLImageName];
//this string is an example of your email body text with HTML formatting
NSString *emailText = [NSString stringWithFormat:@"%@%@%@",@"<html><head><title>My Inline Image Example Email</title></head><body><p>Here's some text before the inline image</p><p><img src = \"",imagePath,@"\"></p><p>Here's some text for after the inline image. You could add more inline images and text after this with the same kind of formatting.</p></body></html>"];
//create email
MFMailComposeViewController *emailDialog = [[MFMailComposeViewController alloc] init];
emailDialog.mailComposeDelegate = self;
[emailDialog setSubject:@"My Inline Image Email Document"];
[emailDialog setMessageBody:emailText isHTML:YES];
[self presentModalViewController:emailDialog animated:YES];
[emailDialog release];
}