Send Email iOSSend email from you iPhone/iPad app is easy. Simply use the MailComposerViewController to launch the main composer interface. The values for the mail related fields like Subject, Body etc. can be pre populated as well. Basic steps: Add MessageUI Framework to the Project -> Create the ViewController on send Email Button or some other trigger and write the Handler to display Success or Error  -> Populate Values -> Launch the view using presentModalViewController on the view controller.
  1. #import <MessageUI/MessageUI.h>
  2. #import <MessageUI/MFMailComposeViewController.h>
  3. // Displays an email composition interface inside the application. Populates all the Mail fields.
  4. - (void)sendEmail: (id) sender {
  5.         debugLog(@"notify Others");
  6.         MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
  7.         picker.mailComposeDelegate = self;
  8.         [picker setSubject: @"Check out Infuze (iPad/iPhone App)"];
  9.         // Set up recipients
  10.         /*NSArray *toRecipients = [NSArray arrayWithObject:@"first@example.com"];
  11.            NSArray *ccRecipients = [NSArray arrayWithObjects:@"second@example.com", @"third@example.com", nil];
  12.            NSArray *bccRecipients = [NSArray arrayWithObject:@"fourth@example.com"];
  13.            [picker setToRecipients:toRecipients];
  14.            [picker setCcRecipients:ccRecipients];
  15.            [picker setBccRecipients:bccRecipients];*/
  16.         // Attach an image to the email
  17.         //NSString *path = [[NSBundle mainBundle] pathForResource:@"rainy" ofType:@"png"];
  18.         //NSData *myData = [NSData dataWithContentsOfFile:path];
  19.         //[picker addAttachmentData:myData mimeType:@"image/png" fileName:@"rainy"];
  20.         // Fill out the email body text
  21.         NSString *emailBody = @"Hi,
  22. Check out this cool iPad/iPhone application called as Infuze that I am using in Itunes or AppStore..
  23. Cheers";
  24.         // html email
  25.         [picker setMessageBody: emailBody isHTML: YES];
  26.         if (picker != nil) {
  27.                 [self presentModalViewController: picker animated: YES];
  28.                 [picker release];
  29.         }
  30.         else
  31.         {
  32.           NSLog(@"Mail not configured on the device");
  33.         }
  34. }
  35. // Dismisses the email composition interface when users tap Cancel or Send. Proceeds to update the message field with the result of the operation.
  36. - (void)mailComposeController: (MFMailComposeViewController *) controller didFinishWithResult: (MFMailComposeResult) result error: (NSError *) error {
  37.         NSString *message;
  38.         UIAlertView *v;
  39.         // Notifies users about errors associated with the interface
  40.         switch (result) {
  41.         case MFMailComposeResultCancelled:
  42.                 message = @"Result: canceled";
  43.                 break;
  44.         case MFMailComposeResultSaved:
  45.                 message = @"Result: saved";
  46.                 break;
  47.         case MFMailComposeResultSent:
  48.                 message = @"Sent Email OK";
  49.                 //v = [[UIAlertView alloc] initWithTitle:@"App Email" message:message delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
  50.                 //[v show];
  51.                 //[v release];
  52.                 break;
  53.         case MFMailComposeResultFailed:
  54.                 message = @"Failed to Send Email";
  55.                 v = [[UIAlertView alloc] initWithTitle: @"Notify Infuze" message: message delegate: self cancelButtonTitle: @"OK" otherButtonTitles: nil, nil];
  56.                 [v show];
  57.                 [v release];
  58.                 break;
  59.         default:
  60.                 message = @"Result: not sent";
  61.                 break;
  62.         }
  63.         // display an error
  64.         [self dismissModalViewControllerAnimated: YES];
  65. }