tags:

views:

395

answers:

2

What's the best way of sending an email with an image from the application to the Mail.app for someone to send to any contact they like?

For example, in my app (iMood), you can select a 'mood', I'd like the user to be able to email this to a friend for example, by using a button in the navigation bar.

I can easily create the button etc. but just need to know a way to enable the user to send the image (ie. image.png) from the project to Mail.app as maybe an attachment or a picture in the email.

Thanks in advance.

+1  A: 

This question has been answered many times and in many different forms.

Short answer: you can't. There is no API that allows you access to Mail attachments, and Apple's implementation of the mail URL scheme does not support attachments either.

To accomplish this, you have a couple of very unattractive options:

1) Build-in your own SMTP client. There are some Open Source libraries that are working toward this, but it's still a pain

2) Send the image to a third part server (yours) and compose and send the mail from there. Users probably won't like the possibility you collecting email addresses for nefarious purposes.

In your case, the best thing to do is save the image to the Photo Library. From there, users can send email with the photo.

If you'd like to see Apple enable email attachments, please file a request.

August
A: 

It's possible and David J. Hinson has written a good blog entry about it here

epatel
Cheers for that! I just need to convert the NSData to Base64 now :P
Domness