views:

156

answers:

1

Hi, I was wondering if anyone knew how to use an image in the body of an email when the mail app is opened. Can anyone help?

Thanks in advance Kieran.

+1  A: 
NSData *photoData = UIImageJPEGRepresentation([UIImage imageNamed:@"qwerty.png"], 1);
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
[picker addAttachmentData:photoData mimeType:@"image/jpg" fileName:[NSString stringWithFormat:@"photo.png"]];

I wrote the code by hand so it might have some mistake, but you should get the general idea.

dusker
Hi, thanks for the code. It worked fine but when I click the button nothing happens?
Wilky94