i am trying to send an e-mail with multiple attachments.
Intent emailIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {"email1@email.com", "email2@email.com"});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "The Subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "The Text");
emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
emailIntent.setType("text/plain");
startActivity( Intent.createChooser(emailIntent, "Send Email Using: ") );
This works great when I send the email using gmail, but it doesn't attach the attachments if I send the e-mail using the e-mail client on a Nexus One. It has all the text, the subject, etc... but just no attachments. The email account I have is an exchange account if that matters...
If you want to send some files should pay attention! 1. Use with ACTION_SEND_MULTIPLE instead of ACTION_SEND. 2. Use with setType("text/plain") instead of setType("application/image") 3. Use with putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris) instead of putExtra(Intent.EXTRA_STREAM, imageUris)
This works for me.
Tried all this a million times - got it to work but had a nasty warning. Found out it's an Android bug. There's a fix & more info here:
Update: found workaround. Instead of
Put the text as an ArrayList
Voila! No more exception, and the EXTRA_TEXT ends up as the body of the email.
EDIT: I think simply commenting out this line gets rid of the error - but then you don't get to enter any info for a body. In my case that is fine though since I'm only emailing log files. Remove this line to get rid of the warning: 'sendIntent.putExtra(Intent.EXTRA_TEXT, "See attached CSV files.");'
Try This its work fine.