For below mentioned code subject is getting displayed in other email accounts but the same is coming blank in gmail.
Intent j = new Intent(Intent.ACTION_SENDTO);
j.setData(Uri.parse("mailto:[email protected]"));
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!")
}
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"));
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With