-1

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];

}

1 Answers1

2

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];
}
Community
  • 1
  • 1
mahboudz
  • 39,196
  • 16
  • 97
  • 124
  • i did it like NSString *_recipient = @"someone@email.com"; NSURL *_mailURL = [NSURL URLWithString:[NSString stringWithFormat:@"mailto:%@?subject=My Subject", _recipient]]; [[UIApplication sharedApplication] openURL:_mailURL]; but it did not give output......i created on button in which i coded above thing... –  Oct 06 '09 at 04:24
  • 2
    This doesn't do anything in the simulator. On the iPhone, it should quit your app and launch Mail. – mahboudz Oct 06 '09 at 06:37