Android 的 Gmail 应用程序是否取消了通过 Intent 发送 HTML 电子邮件的功能? [英] Has Android's Gmail app removed the ability to send HTML emails via Intent?

查看:22
本文介绍了Android 的 Gmail 应用程序是否取消了通过 Intent 发送 HTML 电子邮件的功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过 Intent 发送 HTML 电子邮件.似乎接受的方法如下:

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:"));

这在 Gmail v6.11.2 和 7.1.129 中不起作用,并且会生成纯文本输出.我看到的唯一识别标签是 <p><br>.

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>.

我的电子邮件必须可由用户编辑,因此不能通过 JavaMail API 在后台发送它.

My email must be editable by the user, so sending it in background via JavaMail API is not an option.

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

和:emailIntent.putExtra(android.content.Intent.EXTRA_HTML_TEXT, "Hello I am <b>bold</b> text.");

如果这曾经有效,有人可以确认这是该用户建议的 Gmail 应用程序功能的回归:https://stackoverflow.com/a/41596827/1319081,还是我做错了什么?

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?

推荐答案

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 只支持一些 Tag..欲了解更多信息,请查看以下链接..

Android support only some Tag.. For more information check below link..

链接 1

链接 2

这篇关于Android 的 Gmail 应用程序是否取消了通过 Intent 发送 HTML 电子邮件的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆