Possible Duplicate:
how can send a file as attachment in objective c
I want to add an image as an attachment in my iPhone application.Now I am attaching the image like this:
NSMutableString * body = [[NSMutableString alloc] initWithString:@"<html><body><img src=\"http://url here\"/>"];
[body appendString:@"</body></html>"];
[mailer setMessageBody:body isHTML:YES];
But instead of url I want to include an image which is in my resource folder.
How can I do the same?
From apple documentation about MFMailComposeViewController; basically you must init the UIImage with your image, extract the image data (e.g.: if it is a PNG use UIImagePNGRepresentation()) and provide the right mime type e.g. image/png. Then use the specified function below (the file name is a name of a file you want to give to the attachment; e.g. “image.png”)
Example: