Android ACTION_SEND超链接无法在GMail中运行

时间:2022-11-15 12:03:38

This is my code for sending an HTML email in Android, with a clickable link.

这是我在Android中发送HTML电子邮件的代码,带有可点击的链接。

private void sendEmail()
{

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
String subject = "Prueba";
String emailtext = "<a href=http://www.google.es>PruebaEmail</a>";
emailIntent.setType("message/rfc822");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(emailtext.toString()));

startActivity(Intent.createChooser(emailIntent, "Send mail"));
}

Months ago, it was working and sends a clickable hyperlink, but for now, when I receive the mail in my GMail account, there is no hyperlink, just plain text.

几个月前,它正在工作并发送一个可点击的超链接,但是现在,当我在我的GMail帐户中收到邮件时,没有超链接,只有纯文本。

I have tried all of this in the type:

我在类型中尝试了所有这些:

emailIntent.setType("message/rfc822");

and

emailIntent.setType("plain/text");

and

emailIntent.setType("text/html");

and this for the text:

这对于文本:

String emailtext = "<a href=http://www.google.es>PruebaEmail</a>";

and

String emailtext = "<a href='http://www.google.es'>PruebaEmail</a>";

and

String emailtext = "<a href="http://www.google.es">PruebaEmail</a>";

but none of that are working.

但这些都不起作用。

This issue is just for GMail, because if I send the mail to Evernote or another app, I got a clickable link.

这个问题仅适用于GMail,因为如果我将邮件发送到Evernote或其他应用程序,我会收到一个可点击的链接。

This is my API configuration:

这是我的API配置:

<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="8"/>

and compiling with Android 3.2

并使用Android 3.2进行编译

Any ideas?

1 个解决方案

#1


1  

OK finally found the solution for the things to work. The link in the href and outside has to be exactly same. Deleted my comments they are now irrelevant.

好的,终于找到了解决方案。 href和外部的链接必须完全相同。删除了我的评论他们现在无关紧要。

The problem is with gmail client 4.2.2 i have the latest one it seems :) The gmail client 4.1.2 worked just fine for the href tag what you had written.

问题是gmail客户端4.2.2我有最新的一个看起来:) gmail客户端4.1.2适用于你写的href标签。

And its really stupid of the gmail client to work like this.

它真的很愚蠢的gmail客户端像这样工作。

#1


1  

OK finally found the solution for the things to work. The link in the href and outside has to be exactly same. Deleted my comments they are now irrelevant.

好的,终于找到了解决方案。 href和外部的链接必须完全相同。删除了我的评论他们现在无关紧要。

The problem is with gmail client 4.2.2 i have the latest one it seems :) The gmail client 4.1.2 worked just fine for the href tag what you had written.

问题是gmail客户端4.2.2我有最新的一个看起来:) gmail客户端4.1.2适用于你写的href标签。

And its really stupid of the gmail client to work like this.

它真的很愚蠢的gmail客户端像这样工作。