简体   繁体   English

Android 的 Gmail 应用程序是否取消了通过 Intent 发送 HTML 电子邮件的功能?

[英]Has Android's Gmail app removed the ability to send HTML emails via Intent?

I would like to send HTML emails via an Intent.我想通过 Intent 发送 HTML 电子邮件。 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.这在 Gmail v6.11.2 和 7.1.129 中不起作用并产生纯文本输出。 The only tags I see recognized are <p> and <br> .我看到的唯一识别标签是<p><br>

My email must be editable by the user, so sending it in background via JavaMail API is not an option.我的电子邮件必须可由用户编辑,因此不能通过 JavaMail API 在后台发送它。

I have also attempted: emailIntent.setType("message/rfc822");我也尝试过: emailIntent.setType("message/rfc822");

and: emailIntent.putExtra(android.content.Intent.EXTRA_HTML_TEXT, "Hello I am <b>bold</b> text.");和: 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?如果这曾经有效,有人可以确认这是该用户建议的 Gmail 应用程序功能的回归: https : //stackoverflow.com/a/41596827/1319081 ,还是我做错了什么?

String body = new String("<html><body><table><tr><td><br/>" +header+"</td></tr><br/><br/>"+"Get <b> Best Score </b> in your Android Phone.<br/>"+"<a href=\"" + link_val + "\">" + text_value+ "</a>");

emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, html.fromHtml(body));

Android support only some Tag.. For more information check below link.. Android 仅支持一些标签。有关更多信息,请查看以下链接。

Link 1 链接 1

Link 2 链接 2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM