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 6081787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:12:53+00:00 2026-05-23T11:12:53+00:00

i done a sample ipad mail composer application to send a image to another

  • 0

i done a sample ipad mail composer application to send a image to another address.so i wrote the following code:

#import  <messageUI/MFMailComposeViewController.h>
//to compose mail
-(IBAction)composeMail{ 
    if([self validateImageView]){
        [self sendSelectedImage];
    }
    else{
        [self showAlert];
    }


}

//to validate image view
-(BOOL)validateImageView{
    if(selectedImageView.image){
        return YES;
    }
    else{
        return NO;
    }
}

//to send selected image
-(void)sendSelectedImage{   

    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    @try {
        picker.mailComposeDelegate = self;  
        [picker setSubject:@"Hello from Triassic!"];


        // Set up recipients
        NSArray *toRecipients = [NSArray arrayWithObject:@"shamsudheen@triassicsolutions.com"]; 
        NSArray *ccRecipients = [NSArray arrayWithObjects:@"shamsudheen@triassicsolutions.com", @"shamsudheen@triassicsolutions.com", nil]; 
        NSArray *bccRecipients = [NSArray arrayWithObject:@"shamsudheen@triassicsolutions.com"]; 

        [picker setToRecipients:toRecipients];
        [picker setCcRecipients:ccRecipients];  
        [picker setBccRecipients:bccRecipients];

        // Attach an image to the email 
        NSData *myData =  UIImagePNGRepresentation(selectedImageView.image);
        [picker addAttachmentData:myData mimeType:@"image/jpeg" fileName:@"rainy"]; 
        // Fill out the email body text
        NSString *emailBody = @"It is raining in Trivandrum!";
        [picker setMessageBody:emailBody isHTML:NO];

        [self presentModalViewController:picker animated:YES];
    }
    @catch (NSException * ex) {
        NSLog([NSString stringWithFormat:@"%@",ex]);
    }
    @finally {
        [picker release];
    }

}

//to show a alert box
-(void)showAlert{   
    UIAlertView *alertView;     
    alertView = [[UIAlertView alloc] initWithTitle:@"Please select a image from PhotoAlbums!" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:@"Continue", nil];
    [alertView show];
    [alertView release];        
}

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation==UIInterfaceOrientationLandscapeRight || interfaceOrientation==UIInterfaceOrientationLandscapeLeft);
}

#pragma mark -
#pragma mark Dismiss Mail/SMS view controller

// Dismisses the email composition interface when users tap Cancel or Send. Proceeds to update the 
// message field with the result of the operation.
- (void)mailComposeController:(MFMailComposeViewController*)controller 
          didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
    @try {
        feedbackMsg.hidden = NO;
        // Notifies users about errors associated with the interface
        switch (result)
        {
            case MFMailComposeResultCancelled:
                feedbackMsg.text = @"Mail sending canceled";
                break;
            case MFMailComposeResultSaved:
                feedbackMsg.text = @"Mail saved";
                break;
            case MFMailComposeResultSent:
                feedbackMsg.text = @"Mail sent";
                break;
            case MFMailComposeResultFailed:
                feedbackMsg.text = @"Mail sending failed";
                break;
            default:
                feedbackMsg.text = @"Mail not sent";
                break;
        }

    }
    @catch (NSException * ex) {
        NSLog([NSString stringWithFormat:@"%@",ex]);
    }
    @finally {
        [self dismissModalViewControllerAnimated:YES];
    }

}

so when compose button clicks it will show a popup with the entered mail address and with all the details.
it showing the result send process is done successfully.but i am not getting any mail to shamsudheen@triassicsolutions.com.may i know what is the mistake i done.can i send a mail through this to another email by entering the popup through the address section.i think the compose method works when popup is loading.then how can i send a mail to address that in entered in the displayed popup.it not working fine ..may i know whats the mistake i done

  • 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-23T11:12:54+00:00Added an answer on May 23, 2026 at 11:12 am

    In Simulator you cannot send the mail because If you want to send a mail to another person first you have to set your maildetails(you have to login to your account) in the account settings in the Device. But that feature is not exists in the Simulator.That’s why you cannot send the email from Simulator.

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

Sidebar

Related Questions

I have written a tab based iPad application which has done well. I never
i have done developed a sample application with the help of tutorials posted on
Consider the following sample code below: #include <iostream> using namespace std; class base {
I have done simple java app for blackberry, while building am getting following error.
I'm probably not doing this correctly. Having not done an iPad app before I'm
I've done this sample to try to understand why I'm not sending cookies at
I have done a few sample projects (just for fun) using Silverlight deep zoom.
I wrote my first sample scala program and it looks like this: def main(args:
Can someone give me a sample code to confine the cursor on to a
My file(sample.txt) has 10 chars. I opened the file in write mode, have done

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.