Email Intent subject is ignored in gmail, but works with other mail clients
ACTION_SENDTO
is not documented to support any extras. So, while you are welcome to include EXTRA_SUBJECT
, do not assume that any particular app responding to ACTION_SENDTO
will honor it.
Even for places where extras are documented — ACTION_SEND
documents support for EXTRA_SUBJECT
, for example — there is no requirement for every app to honor every extra.
Gmail seems to ignore Intent
extras. Try this instead:
Intent j = new Intent(Intent.ACTION_SENDTO);
j.setData(Uri.parse("mailto:[email protected]" +
"?subject=Request approval for Kiranam Registration - " + KiranamUserId));
j.putExtra(Intent.EXTRA_SUBJECT, "Request approval for Kiranam Registration - " + KiranamUserId);
startActivity(Intent.createChooser(j, "Select your mail account to send mail for Approval"));
I found that setting the data part of the intent to Uri.parse("mailto:")
and defining the email via Intent.EXTRA_EMAIL
works fine:
Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:")).apply {
putExtra(Intent.EXTRA_EMAIL, arrayOf("[email protected]"))
putExtra(Intent.EXTRA_SUBJECT, "Support request")
putExtra(Intent.EXTRA_TEXT, "Hello team!")
}