This is a discussion on In-App Email iPhone SDK Tutorial within the iPhone/iPad Programming Tutorials forums, part of the Programming Section category; Hey guys, Here I'll show you how to implement in-app email so users can send email without leaving your App. ...
Hey guys,
Here I'll show you how to implement in-app email so users can send email without leaving your App.
1) First impost MessageUI framework and "MessageUI.h" in your .h file
2) Insert the following code where you want the in-app to be implemented, I'll insert it inside IBAction for a button.Code:#import <MessageUI/MessageUI.h>
If you want to include default email address for your customers to email add the following code:Code:-(IBAction)sendMail { MFMailComposeViewController *mailComposer = [[[MFMailComposeViewController alloc] init] autorelease] ; mailComposer.mailComposeDelegate = self; if ([MFMailComposeViewController canSendMail]) { [mailComposer setToRecipients:nil]; [mailComposer setSubject:nil]; [mailComposer setMessageBody:@"Default text" isHTML:NO]; [self presentModalViewController:mailComposer animated:YES]; } }
instead ofCode:NSArray *toRecipients = [NSArray arrayWithObject:@"me@mozymac.com"]; [mailComposer setToRecipients:toRecipients];
Code:[mailComposer setToRecipients:nil];
That's it, if you have any problems or suggestions please leave a replay.
MozyMac Founder,Chairman and CEO
MacBook Pro Unibody late 2008 2.4Ghz 4GB ram 250GB HD
MozyMac Youtube Channel