Olex
Olex

Reputation: 1656

MFMailComposeViewController few attachments

I'm successfully sending an email with attached UIImage from my app, but is it possible to attach more than one image with MFMailComposeViewController ?

Upvotes: 1

Views: 1086

Answers (2)

Kaushal Bisht
Kaushal Bisht

Reputation: 486

you can save all the images in an NSMutable array and run the code

[mailer addAttachmentData:imageData mimeType:@"image/png" fileName:@""];

for the count of your NSMutableArray. It will add the images to attachment field

  for (int i = 0; i < [_textField0.emojiArray count]; i++)         
 {
    emoji = [_textField0.emojiArray objectAtIndex:i];
  UIImage *image = [EmojiResizer resizeImage2:[UIImage imageNamed:emoji.screenfilename]
   imageData = [NSData dataWithData:UIImagePNGRepresentation(image)];

 [mailViewController addAttachmentData:imageData mimeType:@"image/png" fileName:emoji.filename];         
}

Do something like this.

Upvotes: 5

rmaddy
rmaddy

Reputation: 318934

Call addAttachment... for each attachment you wish to add.

Upvotes: 2

Related Questions