I use the following code to send email from my android application:
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{"email@yahoo.com"});
email.putExtra(Intent.EXTRA_SUBJECT, "subject");
email.putExtra(Intent.EXTRA_TEXT, "message");
emailIntent.putExtra(Intent.EXTRA_STREAM, uri);
email.setType("plain/text");
startActivity(Intent.createChooser(email, "Choose an Email App:"));
This works great for all email sending applications, but shows too many options like Facebook, Twitter, Bluetooth to send this email. I just wanted to see email applications to choose from.
So, I replaced email.setType("plain/text");with email.setType ("message / rfc822");
Now it shows only mail applications and works fine for all mail applications installed on my device except Outlook. Outlook does not send the attachment properly. In the end, I get weird characters instead of an attached file.
Then I replaced email.setType("message/rfc822");with email.setType ("application / octet-stream");
This solved the problem with Outlook attachments, but now I can not send emails using the default Android email application. It sends email without attachments.
source
share