user2996143
user2996143

Reputation: 113

MFMailComposer Mail sent callback

I have been working on app that capture images and video and then send it to mail via MFMailComposer. I have created zip file of content and size around 6MB. I want to show loading view when user click on send button and hide mail controller and when mail actually sent i want to show the message via alert. Is there any way to do it? Any help will be appreciated.

Upvotes: 0

Views: 366

Answers (1)

lukas
lukas

Reputation: 2410

You can use the MFMailComposeViewControllerDelegate Methods to get info if the mail has been sent:

- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{

    switch (result)
    {
        case MFMailComposeResultCancelled:
            NSLog(@"Mail cancelled");
            break;
        case MFMailComposeResultSaved:
            NSLog(@"Mail saved");
            break;
        case MFMailComposeResultSent:
            NSLog(@"Mail sent");
            break;
        case MFMailComposeResultFailed:
            NSLog(@"Mail sent failure: %@", [error localizedDescription]);
            break;
        default:
            break;
    }

// Close the Mail Interface
[self dismissViewControllerAnimated:YES completion:NULL];
}

Don't forget to add the MFMailComposeViewControllerDelegate to your .h file

Upvotes: 1

Related Questions