Android Studio mailto Intent doesn’t show subject and mail body

I think we had the same issue. Android API 29 introduced some improvements about sending data to other apps. See more details here: Sending simple data to other apps

Here is the solution that works for me.

Intent selectorIntent = new Intent(Intent.ACTION_SENDTO);
selectorIntent.setData(Uri.parse("mailto:"));

final Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{"address@mail.com"});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "The subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "The email body");
emailIntent.setSelector( selectorIntent );

activity.startActivity(Intent.createChooser(emailIntent, "Send email..."));

In few words, with this you are asking for the Android standard app chooser and, in addition, you specify that you want to send an email. So, as result, email clients will appear only.
If user has one email client installed only, the intent will redirect to it instantly.

Hope this helps you too.

Leave a Comment