在Android中发送HTML格式化的电子邮件 [英] Sending HTML formated email in Android

查看:1207
本文介绍了在Android中发送HTML格式化的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地创建了一个Android应用程序,计算价格,然后是能够在preformated的方式将数据传输到的用户选择电子邮件程序。根据在应用程序用户创建该数据,包含HTML字符串被读入的意图。在code我对这个是:

I have successfully created an Android app that calculates prices and then is able to transfer that data in a preformated fashion to an email program of the users choice. Depending upon the data the user creates in the app, a string containing the HTML is read into an intent. The code I have for this is:

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

emailIntent.setType("text/html");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(emailText));
QuoteDroid.this.startActivity(emailIntent);

这是一切优秀和电子邮件是 大多当我选择的Gmail应用程序,一般发送的格式化正确的大多正确的。这个问题我有,这是我必须从非Gmail帐户发送用于商业目的。当我选择在手机上通用的电子邮件应用程序不处理HTML正常,当我发送的电子邮件被格式化的纯文本。

This is all fine and the email is mostly formated correct when I choose the Gmail app, and generally sends mostly correct. The issue I have with this is that I must send it from a non-gmail account for business purposes. When I choose the generic email app on the phone it does not process the HTML properly and when I send the email it is formated in plain text.

我已经经历了无数的文章和论坛帖子阅读,但无济于事。我如何处理字符串,包含HTML,以这样的方式,该电子邮件-after发送与内置在电子邮件APP-被视为正确格式化由接收机?

I've read through countless articles and forum posts, but to no avail. How do I process the string, containing the HTML, in such a way that the email -after being sent with the built in email app- is viewed properly formated by the receiver?

推荐答案

这取决于个人的邮件应用程序,以正确处理它接收的EXTRA_TEXT字符串。行为良好的邮件应用程序将看到MIMETYPE并适当处理EXTRA_TEXT,但不是所有的邮件应用程序做的。

It's up to the individual mail app to properly handle the String that it receives as the EXTRA_TEXT. A well-behaved mail app will see the mimetype and handle the EXTRA_TEXT appropriately, but not all mail apps do.

这篇关于在Android中发送HTML格式化的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆