Sending an email with attachments
Problem:You want to send an e-mail with attachments.
Solution:We're going to create an Intent, add extended data to specify the file we want to include and start a new activity to allow the user to send the e-mail.
Discussion:The easiest way to send an e-mail is to create an Intent of type ACTIONSEND.
To attach a single file, we add some extended data to our intent:
The MIME type can always be set as text/plain but you may want to be more specific so applications parsing your message will work properly. For instance if you're including a JPEG image you should write image/jpeg.
To send an e-mail with multiple attachment the procedure is slightly different:
First, we need to use Intent.ACTIONSENDMULTIPLE, which is available since Android 1.6.
Second, we need to create an ArrayList with the URIs of the files we want to attach to the mail and
If sending different type of files you may want to use multipart/mixed as MIME type.
Finally, in both cases, you can start a new Activity with the following code:
Intent.createChooser is optional but will allow the user to select his favourite application
to send the e-mail.
Downloads:(not handled yet)