This is the code which can help u but dont forget to include message ui framewark and include delegates method MFMailComposeViewControllerDelegate
-(void)EmailButtonACtion{
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller.navigationBar setBackgroundImage:[UIImage imageNamed:@"navigation_bg_iPhone.png"] forBarMetrics:UIBarMetricsDefault];
controller.navigationBar.tintColor = [UIColor colorWithRed:51.0/255.0 green:51.0/255.0 blue:51.0/255.0 alpha:1.0];
[controller setSubject:@""];
[controller setMessageBody:@" " isHTML:YES];
[controller setToRecipients:[NSArray arrayWithObjects:@"",nil]];
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
UIImage *ui = resultimg.image;
pasteboard.image = ui;
NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(ui)];
[controller addAttachmentData:imageData mimeType:@"image/png" fileName:@" "];
[self presentViewController:controller animated:YES completion:NULL];
}
else{
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"alrt" message:nil delegate:self cancelButtonTitle:@"ok" otherButtonTitles: nil] ;
[alert show];
}
}
-(void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
[MailAlert show];
switch (result)
{
case MFMailComposeResultCancelled:
MailAlert.message = @"Email Cancelled";
break;
case MFMailComposeResultSaved:
MailAlert.message = @"Email Saved";
break;
case MFMailComposeResultSent:
MailAlert.message = @"Email Sent";
break;
case MFMailComposeResultFailed:
MailAlert.message = @"Email Failed";
break;
default:
MailAlert.message = @"Email Not Sent";
break;
}
[self dismissViewControllerAnimated:YES completion:NULL];
[MailAlert show];
}