android - ACTION_SEND 文本/html 未使用 html 图像标签发送图像

标签 android

我正在发送并通过电子邮件发送带有嵌入 anchor 标记的图像标记。

<p><a href=\"http://www.mycompanyurl.com\"><img src=\"http://www.mycompanyurl.com/assets/images/emails/logo_phone.png\" width=\"82\" height=\"22\" vspace=\"5\" border=\"0\"></a><br>"

当我收到电子邮件时,我在接收端得到的是电子邮件正文中的“obj”标签。链接工作正常,但图像不显示。我错过了什么?非常感谢您对此事的任何帮助或提示。下面是我的代码。

final Intent email = new Intent(Intent.ACTION_SEND);
email.setType("text/html");
email.putExtra(Intent.EXTRA_SUBJECT, "test html with images");
email.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(new StringBuilder()
.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\">")
.append("<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" />")
.append("<title>test html with images</title><style type=\"text/css\"><!--body,td,th {  font-family: Arial, Helvetica, sans-serif;  font-size: 12px;    color: #000000;}body {  background-color: #FFFFFF;}a {  font-size: 12px;    color: #000000;}a:visited { color: #000000;}a:hover {   color: #666666;}a:active {  color: #000000;}--></style></head>")        
.append("<html><body bgcolor=\"#FFFFFF\"><div><table width=\"240\" height=\"360\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"><tbody><tr><td align=\"center\" valign=\"top\">") 
.append("<p><a href=\"http://www.mycompanyurl.com\"><img src=\"http://www.mycompanyurl.com/images/emails/logo_phone.png\" width=\"82\" height=\"22\" vspace=\"5\" border=\"0\"></a><br>").toString()));

最佳答案

Intent、Email 或 Gmail 服务的是什么?

我知道 Gmail 不支持 HTML 电子邮件撰写。它支持链接和 HTML 格式的子集,但不支持 HTML 本身。 Gmail Android 应用或多或少支持您在 Gmail 网络应用中可用的格式。

IIRC 电子邮件应用仅支持链接和基本文本格式,如粗体、斜体等。

关于android - ACTION_SEND 文本/html 未使用 html 图像标签发送图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6445014/

相关文章:

android - 删除后如何重新生成build.gradle文件

android - 可绘制形状的大小可以设置为 fill_parent 吗?

java - 如何为多个列表重用 BaseAdapter View

android - 上传到 Google Play 商店时为应用程序启用 GCM

android - 从桌面无线上传并在手机上启动 apk 以进行开发

android - 在android中实现两个微调器之间的关系

android - 如何获取我保存在 sharedpreference 中的 json 对象的值从一个 Activity 到另一个 Activity ?

java - 以编程方式在 Android 中获取设备操作系统版本

android - 从一个 Android 应用程序向另一个应用程序发送广播

导致强制关闭的Android音频管理器方法