使用表标签在Android的电子邮件电子邮件、标签、Android

2023-09-13 01:34:00 作者:捂眼藏泪

我想我的应用程序来构建一些HTML,并把它传递了一个电子邮件,以便我的用户可以将其发送到他们想要的任何人。我发现,展示了如何通过一个意图通过HTML网页上的code,但现在看来,Html.fromHtml(字符串源)不理解table标签。反正我有可以用格式化表格标记的电子邮件?我想它通过用户的preferred客户端,而不是发送用JavaMail发送它自己的。

I want my app to construct some HTML and pass it over to an email so my user can send it to whomever they want. I found code on the web that shows how to pass the html via an Intent, but it appears that Html.fromHtml(String source) doesn't understand table tags. Is there anyway I can format an email with table tags? I want to send it through the user's preferred client instead of sending it myself with javamail.

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/html");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body));
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
activity.startActivity(Intent.createChooser(emailIntent, "Email:"));

有什么建议?

推荐答案

不幸的是,<表>不支持标记。支持的标签实际上是更多地依赖用来发送电子邮件的电子邮件客户端上 - 其中有些是比较娇气/严格的比别人好。他们大多使用超​​基本的格式标签,如< B> < I> < H1> ,等等,虽然。在多个布局为导向的标签是多了很多参差不齐的,有的(如<表> )。不支持在所有

Unfortunately, the <table> tag isn't supported. Supported tags are actually more dependent on the email client you use to send the email - some of them are more finicky/restrictive than others. Most of them use the super-basic formatting tags like <b>, <i>, <h1>, and so on, though. The more layout-oriented tags are a lot more spotty, and some (like <table>) aren't supported at all.