I would like to send HTML emails via an Intent. It seems that the accepted way to do this is as follows:
String body = "I am <b>bold text</b> and I am <i>italic text</i> and I am normal text.";
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/html");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body));
startActivity(Intent.createChooser(emailIntent, "Email:"));
This does not work in Gmail v6.11.2 and 7.1.129 and produces plain text output. The only tags I see recognized are <p>
and <br>
.
My email must be editable by the user, so sending it in background via JavaMail API is not an option.
I have also attempted: emailIntent.setType("message/rfc822");
and: emailIntent.putExtra(android.content.Intent.EXTRA_HTML_TEXT, "Hello I am <b>bold</b> text.");
If this was once working, can someone confirm that this is a regression in the Gmail app's functionality as suggested by this user: https://stackoverflow.com/a/41596827/1319081, or am I doing something wrong?