What’s the best way to send an email through an iPhone app?

1145760 pts.
Tags:
iPhone
Mobile
I've been trying to send an email from an iPhone application but I can't figure out how. I know the iOS SDK doesn't have an email API and I can't use the following code because it automatically exits my application.
NSString *url = [NSString stringWithString: @"mailto:foo@example.com?cc=bar@example.com&subject=Greetings%20from%20Cupertino!&body=Wish%20you%20were%20here!"];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
So what's the best way to go through with this.
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

You need to import MessageUI/MFMailComposeViewController.h and use the MFMailComposeViewController class.

Here is the reference documentation:

MFMailComposeViewController Class Reference – iOS Developer Library

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: