简体   繁体   中英

Iphone mail application

It is possible open Iphone Mail application without compose new message?

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"mailto:%@?subject=My Subject", _recipient]]];

This code not suitable for me.

I need just open mail application on main screen.

Thanks

PS Sorry for my English ))

   -(void) EmailMethod
  {
    MFMailComposeViewController *picker=[[MFMailComposeViewController alloc]init]; 
picker.mailComposeDelegate = self;
    [picker setToRecipients:@"mailid@mymail.com"];
[picker setSubject:@"Place your subject of mail here."];
[picker setMessageBody:@"Place your body of mail here." isHTML:YES];
    [self presentModalViewController:picker animated:YES];      
  }

   - (void)mailComposeController:(MFMailComposeViewController*)controller 
           didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
 {   
    switch (result)
    {
     case MFMailComposeResultCancelled:
         UIAlertView *ErrorAlert = [[UIAlertView alloc] initWithTitle:@"Canceled !!" 
                      message:@"Mail sending cancelled." delegate:nil  
                      cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
        [ErrorAlert show];
        [ErrorAlert release];
        break;
     case MFMailComposeResultSaved:
        UIAlertView *ErrorAlert = [[UIAlertView alloc] initWithTitle:@"Saved" 
                                  message:@"Mail saved to Drafts." delegate:nil  
                                  cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
        [ErrorAlert show];
        [ErrorAlert release];
        break;
    case MFMailComposeResultSent:
        UIAlertView *ErrorAlert = [[UIAlertView alloc] initWithTitle:@"Email Sent" 
                     message:@"Thank you for recommending us to your friends via Email." 
                     delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
        [ErrorAlert show];
        [ErrorAlert release];
        break;
    case MFMailComposeResultFailed:
        UIAlertView *ErrorAlert = [[UIAlertView alloc] initWithTitle:@"Error !!" 
                                  message:@"Failed to send mail." delegate:nil  
                                  cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
        [ErrorAlert show];
        [ErrorAlert release];
        break;
    default:
        UIAlertView *ErrorAlert = [[UIAlertView alloc] initWithTitle:@"Error !!" 
                                  message:@"Failed to send mail." delegate:nil  
                                  cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
        [ErrorAlert show];
        [ErrorAlert release];
        break;
}
[self becomeFirstResponder];
[self dismissModalViewControllerAnimated:YES];

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM