【发布时间】:2017-04-28 16:19:19
【问题描述】:
我一直在使用 Intents 从我的应用程序中使用 Android 上的 Gmail 发送 HTML 格式的电子邮件。它工作正常,但现在即使在 Gmail 撰写显示中也不显示格式。 gmail应用程序中是否还有另一个错误??
注意:我已经解决了这些问题 bug in gmail 4.something 和 broken gmail intents
我的代码是这样的
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType(HTML_TEXT);
String htmlContentInStringFormat = createHtmlforEmail(context, name, channelLink);
if (htmlContentInStringFormat != null) {
intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(htmlContentInStringFormat));
}
intent.putExtra(Intent.EXTRA_SUBJECT, name);
注意 2: 之前它工作正常,因此 html 没有问题。
我的 HTML 看起来像这样
<div align="center">
<font size="5" color="#D0021B" face="Helvetica, Arial, sans-serif">CHARE</font>
<p><font size="3" color="black" face="Helvetica, Arial, sans-serif">Dear Receiver,</font></p><p><font size="3" color="black" face="Helvetica, Arial, sans-serif">The sender of this email wants to invite you to this CHARE channel %1$s. Please click the subscribe button below to subscribe the channel.</font> </p> <p><a href=%2$s><font size="5" color="#5188de" face="Helvetica, Arial, sans-serif">Subscribe</font></a> </p> <p><font size="3" color="black" face="Helvetica, Arial, sans-serif">More information is available under</font></br><a href="www.chare.one"><font size="3" color="#5188de" face="Helvetica, Arial, sans-serif">www.chare.one</font></a></p></div>
我也尝试了下面给出的非常简单的 html 版本
"Hello, here is some <b>bold text</b> some <u>underline text</u> and <a href=\"http://www.google.com\">a link</a>."
但 gmail 仍然没有设置格式。 如果有人指出我正确的方向,那就太好了。
欢迎提出与一些替代方案相关的建议。
【问题讨论】:
-
您找到解决方法了吗?在 Gmail v6.11.2 和 7.1.129 上使用任何常见的“通过意图发送 html 电子邮件”解决方案(包括您的代码)时,我都会遇到同样的问题。
-
我认为 Gmail 已删除此功能。
-
您是否检查过您是否在 Gmail 上以 HTML 格式而不是纯文本格式查看电子邮件?
标签: android html email android-intent gmail