Created
November 16, 2012 22:09
-
-
Save casspangell/4091330 to your computer and use it in GitHub Desktop.
Email Within App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <MessageUI/MessageUI.h> | |
#import <MessageUI/MFMailComposeViewController.h> | |
// Add the MFMail Delegate | |
@interface MailViewController : UIViewController <MFMailComposeViewControllerDelegate>{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(IBAction)sendEmail{ | |
if ([MFMailComposeViewController canSendMail]) { | |
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init]; | |
mailViewController.mailComposeDelegate = self; | |
[mailViewController setToRecipients:[NSArray arrayWithObject:@"[email protected]"]]; | |
[mailViewController setSubject:@"Clip Radio Feedback"]; | |
[mailViewController setMessageBody:@"" isHTML:NO]; | |
[self presentModalViewController:mailViewController animated:YES]; | |
[mailViewController release]; | |
} | |
} | |
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { | |
[self becomeFirstResponder]; | |
[self dismissModalViewControllerAnimated:YES]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment