使用 Gmail 4.2.1 发送 HTML 电子邮件

Send HTML email with Gmail 4.2.1(使用 Gmail 4.2.1 发送 HTML 电子邮件)

本文介绍了使用 Gmail 4.2.1 发送 HTML 电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Gmail 4.2.1 似乎可能破坏了 HTML 格式的电子邮件.以下代码在 4.2.1 之前完美运行.从 Gmail 发送的电子邮件具有所需的嵌入式链接、粗体和带下划线的字词.不幸的是,在更新到 4.2.1 之后,发送的电子邮件看起来好像所有的 HTML 格式都被删除了.我希望可能有人找到解决方法?

It seems that Gmail 4.2.1 may have broken HTML-formatted emails. The following code worked perfectly prior to 4.2.1. The email that was sent from Gmail had the desired embedded links, bolded and underlined words. Unfortunately, after updating to 4.2.1, the email that gets sent appears as if all the HTML formatting has been stripped out. I am hoping there may be a workaround for this that maybe someone has found?

final Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("message/rfc822");
String[] toArr = new String[] { "someone@somewhere.com" };
intent.putExtra(Intent.EXTRA_EMAIL, toArr);
intent.putExtra(Intent.EXTRA_SUBJECT, "This is a subject");
intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml("Hello, here is some <b>bold text</b> some <u>underline text</u> and <a href="http://www.google.com">a link</a>."));

有趣的事情(或者可能不是?)是这封电子邮件的撰写预览显示了所有粗体、下划线和链接的文本,正如人们所期望的那样.但是当它被发送时,收件人会收到一封去掉所有内容的电子邮件.

The interesting thing (or maybe not?) is that the compose preview of this email message shows all of the bolded, underlined and linked text as one would expect it to appear. But when it gets sent, the recipient gets the email with all of that stuff stripped out.

是的,我知道 其他问题 关于这个已关闭.我认为它可能是过早关闭的,我希望这里的额外细节可能值得再看一下.

And yes, I am aware of this other question about this that was closed. I think that maybe it was closed prematurely and am hoping that the additional detail here may warrant another look.

更多信息:经过进一步研究,这个问题远不止通过意图发送 HTML 电子邮件.如果使用具有某些格式(粗体、下划线、超链接等)的 GMail 网络应用程序创建草稿电子邮件,然后在您的 GMail Android 应用程序(v4.2.1)上打开该草稿电子邮件,您的所有格式都会显示被保留.但是,如果您随后使用 GMail Android 应用发送该电子邮件草稿,则在发送电子邮件之前,您的所有格式都会被删除.

MORE INFORMATION: Upon further research, this problem is way bigger than just sending HTML email via intents. If one creates a draft email using the GMail web app that has some formatting (bold, underline, hyperlinks, etc.), then open that draft email on your GMail Android app (v4.2.1) it will appear that all of your formatting has been kept. However, if you then send that draft email using your GMail Android app, all of your formatting will be stripped out before the email is sent.

推荐答案

这几乎可以肯定是 GMail 4.2.1 中的一个错误.

This was almost certainly a bug in GMail 4.2.1.

截至 2013 年 3 月 19 日,GMail 4.3 发布,似乎修复了该错误.

As of March 19, 2013, GMail 4.3 was released which appears to fix the bug.

这篇关于使用 Gmail 4.2.1 发送 HTML 电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:使用 Gmail 4.2.1 发送 HTML 电子邮件

基础教程推荐