Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9108013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:42:30+00:00 2026-06-17T02:42:30+00:00

I have an app that allows the user to send a test email from

  • 0

I have an app that allows the user to send a test email from their iPhone. My app calls a method to activate the compose mail function like this:

-(void)displayComposerSheet
{

    //set up a way to cancel the email here
    //picker is an instance of MSMailComposeViewController already declared in the .h file

    [picker setSubject:@"Test Mail"];

    // Set up recipients

    // Attach an image to the email
    NSString *path = [[NSBundle mainBundle] pathForResource:@"Icon" ofType:@"png"];
    NSData *myData = [NSData dataWithContentsOfFile:path];
    [picker addAttachmentData:myData mimeType:@"image/png" fileName:@"Icon"];

    // Fill out the email body text
    NSString *emailBody = @"This is a test mail.";
    [picker setMessageBody:emailBody isHTML:NO];

    [self presentModalViewController:picker animated:YES];
    NSLog(@"mail is working");

}


- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
    emailLabel.hidden = NO;
    // Notifies users about errors associated with the interface
    switch (result)
    {
        case MFMailComposeResultCancelled:
            emailLabel.text = @"Mail sending canceled.";
            break;
        case MFMailComposeResultSaved:
            emailLabel.text = @"Mail saved.";
            break;
        case MFMailComposeResultSent:
        {
            emailLabel.text = @"Mail sent.";
            NSLog(@"It's away!");


            UIAlertView *emailAlertView = [[UIAlertView alloc] initWithTitle:@"Sent!" message:@"Mail sent successfully." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
            [emailAlertView show];
            [self dismissModalViewControllerAnimated:YES];
            [self.navigationController popViewControllerAnimated:YES];


        }
            break;
        case MFMailComposeResultFailed:
        {
            emailLabel.text = @"Mail sending failed.";


        }
            break;
        default:
        {
            emailLabel.text = @"Mail not sent.";

        }
        break;
    }

}

My problem is that when the compose email function is active, I am unable to come out of this function and return to my app. The only way out of this is by actually going ahead and sending a message. There is a default “cancel” bar button that appears on the top left hand corner of the navigation bar, which when clicked, gives me three options: “delete draft”, “save draft”, and “cancel”. If I select “delete draft”, it does nothing except to return me to the compose message screen. Is there a way for me to allow the user to return to the app after starting the compose mail function, but prior to sending it? Is there a way to add extra functionality to the “cancel” bar button to accomplish this?

Thanks in advance to all who reply.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T02:42:32+00:00Added an answer on June 17, 2026 at 2:42 am

    You have to implement MFMessageComposeViewControllerDelegate with the - (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result method.

    You will dismiss your message view in this method.

    EDIT : i confused with MFMailComposeViewControllerDelegate but the purpose is the same as with MFMessageComposeViewControllerDelegate

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that allows the user to choose a picture from their
We have an app that allows users to send e-mails from our system. It
I have a simple little email app that allows a user to pick certain
I have an app that allows the user to either select a video from
I have an app that allows a user to transmit their location to a
I have made app which allows me to send message to multiple user from
I have an app that allows the user to choose an image, at design
I have a small tab on an app that allows user to lookup a
I have an iPhone app that allows users to record videos and I'd like
I have a facebook app that needs to allow a user to send a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.