Send HTML email with Gmail 4.2.1(使用 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 电子邮件
基础教程推荐
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01