Tutorial details

In App Email | App Code for Sale | Preview

In App Email | iOS Tutorial

How to directly email from your app

Overview PAGE TOP

Reference: http://www.geekylemon.com/WEBPROTECT-xcodeinappemail.htm

In this tutorial i will be showing you how to directly email from your app

Features:

  • 1 Round Rect Button

In app emailing is a great feature for any developer and can be used to gather instant feedback from the customer or even a way to share your apps content improving the app and reaching a higher audience

ViewController. PAGE TOP

#import<MessageUI/MFMailComposeViewController.h>
@interface ViewController :UIViewController <MFMailComposeViewControllerDelegate> {
}
-(IBAction)email;
@end

ViewController.m PAGE TOP

@implementation ViewController
-(IBAction)email {
MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
    [composer setMailComposeDelegate:self];
if ([MFMailComposeViewController canSendMail]) {
        [composer setToRecipients:[NSArray arrayWithObjects:@"123@abc.com", nil]];
        [composer setSubject:@"subject here"];
        [composer setMessageBody:@"message here" isHTML:NO];
        [composer setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
        [self presentModalViewController:composer animated:YES];
        [composer release];
    }
else
        [composer release];
}
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
if (error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"error"
message:[NSString stringWithFormat:@"error %@", [error description]]
delegate:nil cancelButtonTitle:@"dismiss" otherButtonTitles:nil, nil];
        [alert show];
        [alert release];
        [self dismissModalViewControllerAnimated:YES];
    }
else {
        [self dismissModalViewControllerAnimated:YES];
    }
}
@end

Reference PAGE TOP

http://www.geekylemon.com/WEBPROTECT-xcodeinappemail.htm

0 Comments Leave a comment

Please login in order to leave a comment.

Newest first
!

Sign-in to your Chupamobile Account.

The Easiest way to Launch your next App or Game.

Join Chupamobile and get instant access to thousands of ready made App and Game Templates.

Creating an account means you’re okay with Chupamobile’s Terms of Service and Privacy Policy.