Question

How to redirect to mail application from iPhone application? I have seen in Stack Overflow like MailComposerViewController. They are sending email from within the iPhone application. But I want to quit project and redirect it to in-built Mail app Which is in iPhone?

How can I do this?

I have tried the following. Are there any frameworks required for this?

- (IBAction)ddd:(id)sender
{
    NSString *_recipient = @"someone@email.com";
    NSURL *_mailURL = [NSURL URLWithString:[NSString stringWithFormat:@"mailto:%@?subject=My Subject", _recipient]];
    [[UIApplication sharedApplication] openURL:_mailURL];

}
Was it helpful?

Solution

No, there are plenty of stackoverflow posts on how to send e-mail without MFMailComposeViewController. In fact, there was at least one response to your request 16 hours earlier that would quit your app and start Mail

Here's how I do it in my apps, copied exactly as it is:

-(IBAction) mailForHelp:(id)sender
{
    NSString    *urlStr = [NSString stringWithFormat:@"mailto:info@BitsOnTheGo.com?subject=NumMemorize Question"];
    NSURL* mailURL = [NSURL URLWithString:[urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
    [[UIApplication sharedApplication] openURL: mailURL];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top