ACTION_SEND force sending with email
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/html");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
new String[] { "[email protected]" });
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
"Subject of the Mail");
emailIntent.putExtra( android.content.Intent.EXTRA_TEXT,
"This is my sample Mail");
emailIntent.setType("vnd.android.cursor.dir/email");
startActivity(Intent.createChooser(emailIntent, "Email:"));
else use this it will shows only the mail clients,
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("message/rfc822");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
new String[] { "[email protected]" });
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
"Subject of the Mail");
emailIntent.putExtra( android.content.Intent.EXTRA_TEXT,
"This is my sample Mail");
//emailIntent.setType("vnd.android.cursor.dir/email");
startActivity(Intent.createChooser(emailIntent, "Email:"));
Try to setType message/rfc822
instead of text/plain
I think you should change the setType
to
i.setType("message/rfc822") ;
Even though it's too late for @thepoosh, but it may be helpful for future questioners. After a lot of searching and testing, I finally found a good solution. Thanks to the Open source developer, cketti for sharing his/her concise solution.
String mailto = "mailto:[email protected]" +
"?cc=" + "[email protected]" +
"&subject=" + Uri.encode(subject) +
"&body=" + Uri.encode(bodyText);
Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
emailIntent.setData(Uri.parse(mailto));
try {
startActivity(emailIntent);
} catch (ActivityNotFoundException e) {
//TODO: Handle case where no email app is available
}
This is the link to his/her gist.