0
votes

how to insert uiimage into body of mail composer window.. i have with this code:


NSMutableString *emailBody = [[[NSMutableString allocinitWithString:@""] retain];
[emailBody appendString:@"

type text here

"]; UIImage *emailImage = [UIImage imageNamed:@"20-gear2.png"]; NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(emailImage)]; NSString *base64String = [imageData base64EncodedString]; [emailBody appendString:[NSString stringWithFormat:@"

",base64String]]; NSLog(@"emailBody....%@", emailBody); [emailBody appendString:@""]; NSLog(@"emailBody1....%@", emailBody);
2

2 Answers

2
votes
MFMailComposeViewController *mailComposerController =   [[MFMailComposeViewController alloc] init];
[mailComposerController  setSubject:@"Your subject"];
[mailComposerController setMessageBody:nil isHTML:YES];
NSData *imageData   =   UIImagePNGRepresentation([UIImage imageNamed:"your image.png"]);
[mailComposerController addAttachmentData:imageData mimeType:@"image/png" fileName:@"image.png"];

Hope this help you...

0
votes
NSData *imageData = UIImagePNGRepresentation(yourImage);
[mailController addAttachmentData:imageData mimeType:@"image/png" fileName:imageName];