I've been working on Android program to send email with an attachment (image file, audio file, etc) using Intent with ACTION_SEND
. The program is working when email has a single attachment. I used Intent.putExtra(android.content.Intent.EXTRA_STREAM, uri)
to attach the designated image file to the mail and it is working fine, the mail can be delivered through the Gmail. However, when I tried to have multiple images attached to the same mail by calling Intent.putExtra(android.content.Intent.EXTRA_STREAM, uri)
multiple times, it failed to work. None of the attachment show up in the email.
I searched the SDK documentation and Android programming user group about email attachment but cannot find any related info. However, I've discovered that there's another intent constant ACTION_SEND_MULTIPLE
(available since API level 4) which might meet my requirement. Based on SDK documentation, it simply states that it deliver multiple data to someone else, it works like ACTION_SEND
, except the data is multiple. But I still could not figure out the correct usage for this command. I tried to declare intent with ACTION_SEND_MULTIPLE
, then call putExtra(EXTRA_STREAM, uri)
multiple times to attach multiple images, but I got the same erroneous result just like before, none of the attachment show up in the email.
Has anyone tried with ACTION_SEND_MULTIPLE
and got it working with multiple email attachment?
For multiple attachments use
PutParcelableArrayListExtra(Intent.ExtraStream, uris)
where uris variable is aList<IParcelable>().
Here's an example:Hope this helps ;)
Although this is an old thread, but as it is shown on top on google searches i want to add a small hint to make it complete, hence I stumpled upon it.
It is necessary to make the attached files readable for the mail activity, otherwise they will not be attached. So you have to call somewhere
Here is the code you need to create an emailIntent that contains multiple attachments.
ACTION_SEND_MULTIPLE
should be the actionand then
emailIntent.setType("text/plain");
followed by:
This works for me.
Here I found great example http://www.blackmoonit.com/2010/02/filebrowser-send-receive-intents/
you must use