androidemailandroid-activitysendto

ACTION_SENDTO does not work


I want to send out an email from my app. So I used the following code.

String uriText = "abcd@gmail.com" + "?subject=" + URLEncoder.encode("Subject") + "&body=" + URLEncoder.encode("some text here");
Uri uri = Uri.parse(uriText);
Intent sendIntent = new Intent(Intent.ACTION_SENDTO);
sendIntent.setData(uri);
startActivity(Intent.createChooser(sendIntent, "Send Email"));

I have configured both my Gmail and EMail applications. I tested on my Nexus S (JellyBean) and HTC T-Mobile G2 (GingerBread). Both of them shows "No apps can perform this action.".

Does anyone have idea what's wrong here?


Solution

  • If you are going to use ACTION_SENDTO, the Uri should use the mailto: or smsto: scheme. So, try mailto:abcd@gmail.com.