---
title: "Sending email in iOS Objective-C"  
description: "Follow the following step to send email in iOS Objective C-  Step - 1Include theMessageUI.frameworkin your project . Select project go -settings -Ge"  
author: "Sunil Singh"  
published: 2017-01-11  
updated: 2018-03-17  
canonical: https://www.mindstick.com/blog/11255/sending-email-in-ios-objective-c  
category: "ios"  
tags: ["iphone", "ios", "iphone sdk", "objective c"]  
reading_time: 2 minutes  

---

# Sending email in iOS Objective-C

Follow the following step to [send email](https://www.mindstick.com/interview/2006/how-can-you-send-an-email-message-from-an-asp-dot-net-web-page) in iOS [Objective C](https://www.mindstick.com/articles/1806/objective-c-headers-interfaces-methods)-\

**Step - 1** Include the MessageUI.framework in [your project](https://www.mindstick.com/forum/156583/best-way-to-link-bootstrap-file-in-your-project) . [Select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) project go ->[settings](https://www.mindstick.com/blog/63563/steps-to-change-the-wireless-settings-using-linksys-cloud-account) ->General->[Linked](https://answers.mindstick.com/qa/104773/how-to-create-a-linked-list) [Frameworks](https://www.mindstick.com/blog/11763/five-features-of-top-python-frameworks-for-web-developers-in-2018-that-make-everyone-love-it) and Libraries. Tap on + and select MessageUI.framework . Following is the [screen](https://www.mindstick.com/forum/33644/loading-screen-during-ajax-call) shot -

\

![Sending email in iOS Objective-C](https://www.mindstick.com/blogs/50795bbc-be64-488d-a9d5-ecf01064c91c/images/d0390e7f-8903-4844-8d87-83cdb725d557.png)\

\

**Step 2-** #import <MessageUI/MessageUI.h> in your UIViewController.h file. Here is my view controller.h and viewcontroller.m file-

\

```
//// ViewController.h// LoginSample//// Created by MSClient Mac01 on 10/01/17.// Copyright © 2017 Mindstick Software. All rights reserved.//#import <UIKit/UIKit.h>#import <MessageUI/MessageUI.h>@interface ViewController : UIViewController<MFMailComposeViewControllerDelegate>- (IBAction)sendMail:(id)sender;@end//// ViewController.m// LoginSample//// Created by MSClient Mac01 on 10/01/17.// Copyright © 2017 Mindstick Software. All rights reserved.//#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad {[super viewDidLoad];appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];// Do any additional setup after loading the view, typically from a nib.}- (void)didReceiveMemoryWarning {[super didReceiveMemoryWarning];// Dispose of any resources that can be recreated.}- (IBAction)sendMail:(id)sender {MFMailComposeViewController *emailController = [[MFMailComposeViewController alloc] init];emailController.mailComposeDelegate = self;// [emailController setSubject:@"Sample email subject "]; // set default subject// [emailController setMessageBody:@"Hi , this is sample email body" isHTML:NO]; // set Yes if contains html[self presentViewController:emailController animated:YES completion:NULL];}-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{switch (result) {case MFMailComposeResultSent:NSLog(@"E-mail sent successfully.");break;case MFMailComposeResultSaved:NSLog(@"E-mail saved.");break;case MFMailComposeResultCancelled:NSLog(@"E-mail cancelled.");break;case MFMailComposeResultFailed:NSLog(@"E-mail could not be sent.");break;default:break;}[controller dismissViewControllerAnimated:YES completion:nil];}@end
```

\

Following is the screen shot of MFMailComposeViewController -

\

![Sending email in iOS Objective-C](https://www.mindstick.com/blogs/50795bbc-be64-488d-a9d5-ecf01064c91c/images/6dc9f7e4-02b6-49f0-bb9a-e245f48c8765.png)\

\

---

Original Source: https://www.mindstick.com/blog/11255/sending-email-in-ios-objective-c

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
