Emailing photo taken with ImagePickerController?
<p>In my app I want to:
a.) Present camera to user to take picture
b.) Create email and attach picture taken</p>

<p>I figured out how to take the picture. But, I don't know how to attach it to the email. In the examples I've seen the filename is known. This is one example.</p>

<pre><code>picker.mailComposeDelegate = self;
     [picker setSubject:@"I have a pencil for you"];

     UIImage *roboPic = [UIImage imageNamed:@"RobotWithPencil.jpg"];
     NSData *imageData = UIImageJPEGRepresentation(roboPic, 1);
     [picker addAttachmentData:imageData mimeType:@"image/jpg" fileName:@"RobotWithPencil.jpg"];

     NSString *emailBody = @"This is a cool image of a robot I found.  Check it out!";
     [picker setMessageBody:emailBody isHTML:YES];

     [self presentModalViewController:picker animated:YES];
</code></pre>

<p>I am getting the image from the callback method and it does get stored in the camera roll.</p>

<pre><code>- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {


    // Access the uncropped image from info dictionary
    UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
    [picker dismissModalViewControllerAnimated:TRUE];
    [picker release];
     }
</code></pre>

<p>But from there, I'm not sure how to attach the image to the email? Mainly because I don't know what the filename is when a photo is added to the camera roll when the UIImagePickerController camera source is used to obtain it?</p>

<p>So, I guess I need to either:
a.) Find a way to get the name of the image file once it is saved OR
b.) Another way to attach UIImage data as an email attachment.</p>

<p>Any help appreciated.</p>
