iPhone not returning to application after calling eMail send
        Posted  
        
            by Bill
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Bill
        
        
        
        Published on 2010-06-05T23:19:17Z
        Indexed on 
            2010/06/05
            23:22 UTC
        
        
        Read the original article
        Hit count: 323
        
iphone
|objective-c
I am sending an email from within my iPhone application. The eMail page pops up ok, I click on the Send button, the iPhone plays a whoosh sound, and the eMail actually arrives at the recipient.
Unfortunately, the mail dialog still sits there unresponsive, and the only option - to click the home button - kills the app.
Is there something else that needs to be specified to close the eMailMessage view?
MFMailComposeViewController *eMailMessage;
NSArray *toAddress;
if ([MFMailComposeViewController canSendMail]) {
    toAddress = [NSArray arrayWithObject:@"bill@somewhere.com"];
    eMailMessage = [[MFMailComposeViewController alloc] init];
    [eMailMessage setToRecipients:toAddress];
    [eMailMessage setSubject:@"Notification"];
    [eMailMessage setMessageBody:@"Performed by ..." isHTML:NO];
    [self presentModalViewController:eMailMessage animated:YES];
    [eMailMessage release];
}
        © Stack Overflow or respective owner