我正在发送并通过电子邮件发送带有嵌入 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/