Sending Mail
Here, we are starting sending mail project.So, here we using Xcode-6.4v open that-
Here we are give you demo video first for your easy to understand.
Step 2-Give product name anything as in your mind we are taking here “MailDemo” and give next and create.
Step 3- Now, go on ‘Main.storyboard’ and go on ‘File Inspector’ and click on auto layout right mark. so you can show bellow type window.
Step 4-When you are tap on ‘Disable Size Classes’ then will be your simulator window make bellow type.
Step 5-After that take one button from ‘object library’ and give action bellow type by right clicking.
Step 6-When your are release click then you must be see connection is ‘Action’ take show bellow. After that give name ’sendMail’ and click on ‘Connect’.
Step 7-Then click on ‘MailDemo’ here you are showing blue darkest area that our project show bellow.
Step 8-Go on ‘Build Phase’ and in this ‘Link Binary With Libraries’.
Step 9-Add ‘MessegeUI.framework’ library by clicking ‘+’ button.
#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
@interface ViewController : UIViewController<MFMailComposeViewControllerDelegate>
{
MFMailComposeViewController *mailComposer;
}
- (IBAction)sendMail:(id)sender;
@end
Step 11-Now go on ‘ViewController.m’ and write into button and also write delegate method.
- (IBAction)sendMail:(id)sender {
mailComposer = [[MFMailComposeViewController alloc]init];
mailComposer.mailComposeDelegate = self;
[mailComposer setSubject:@"Set Mail"];
[mailComposer setMessageBody:@"Sending messege for the set mail" isHTML:NO];
[self presentViewController:mailComposer animated:YES completion:nil];
}
#pragma mark - mail compose delegate
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
if (result) {
NSLog(@"Result : %d",result);
}
if (error) {
NSLog(@"Error : %@",error);
}
[controller dismissViewControllerAnimated:YES completion:nil];
}
@end
If you are tired so ,Click here. make have some fun.
Step 12-Then run your project by clicking play button.
Step 13-Now you showing your simulator window bellow type.
Step 14-When you are click on ’Send Mail’ button then your window make will be bellow type.
Here you can see into Github 'MailDemo'.
Other video If you are tired so ,Click here. make have some fun.
Comments