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

  • Home
  • SEARCH
  • 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 3443506
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:47:59+00:00 2026-05-18T08:47:59+00:00

I want to mail a file (image) as an attachment by just picking it

  • 0

I want to mail a file (image) as an attachment by just picking it from an Image Picker.
What is the appropriate way I can attach and mail a file (specifically, an image) in iOS Objective-C?

  • 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-05-18T08:48:00+00:00Added an answer on May 18, 2026 at 8:48 am

    Use the method below

    -(void)displayComposerSheet 
    {
        MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
        picker.mailComposeDelegate = self;
        [picker setSubject:@"Check out this image!"];
    
        // Set up recipients
        // NSArray *toRecipients = [NSArray arrayWithObject:@"first@example.com"]; 
        // NSArray *ccRecipients = [NSArray arrayWithObjects:@"second@example.com", @"third@example.com", nil]; 
        // NSArray *bccRecipients = [NSArray arrayWithObject:@"fourth@example.com"]; 
    
        // [picker setToRecipients:toRecipients];
        // [picker setCcRecipients:ccRecipients];   
        // [picker setBccRecipients:bccRecipients];
    
        // Attach an image to the email
        UIImage *coolImage = ...;
        NSData *myData = UIImagePNGRepresentation(coolImage);
        [picker addAttachmentData:myData mimeType:@"image/png" fileName:@"coolImage.png"];
    
        // Fill out the email body text
        NSString *emailBody = @"My cool image is attached";
        [picker setMessageBody:emailBody isHTML:NO];
        [self presentModalViewController:picker animated:YES];
    
        [picker release];
    }
    

    And implement the delegate method

    - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
    {   
        // Notifies users about errors associated with the interface
        switch (result)
        {
            case MFMailComposeResultCancelled:
                NSLog(@"Result: canceled");
                break;
            case MFMailComposeResultSaved:
                NSLog(@"Result: saved");
                break;
            case MFMailComposeResultSent:
                NSLog(@"Result: sent");
                break;
            case MFMailComposeResultFailed:
                NSLog(@"Result: failed");
                break;
            default:
                NSLog(@"Result: not sent");
                break;
        }
        [self dismissModalViewControllerAnimated:YES];
    }
    

    And in your interface file

    #import <MessageUI/MFMailComposeViewController.h>
    ...
    
    @interface ... : ... <MFMailComposeViewControllerDelegate>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please help me, I want to attach file in mail, How can do it.
I want to attach .vcf file with my mail and send through the mail.
I want to record a .caf file then send it as a mail attachment
I want to e-mail my apk file to someone. I started by just copying
I want to mail a simple HTML file containing some data. I want the
I want to put an unique image (1x1) on an e-mail marketing (not spam)
I am using asp.net 3.5 and C#. I want to send mail from asp.net,
I have mail.py file: # coding: utf-8 from ..lib.common import * from ..lib.common import
I have a php file and i want it to send mail every monday
How do I send mail via PHP with attachment of HTML file? -> Content

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.