IO想要在android中以html格式發送電子郵件。我可以通過Gmail客戶端發送郵件,但是當我使用任何其他客戶端時,我無法獲得html的樣式。我用下面的代碼如何在Android中發送HTML郵件
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/html");
i.putExtra(Intent.EXTRA_SUBJECT, "TestMail");
i.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml("<p><b>Some Content</b></p>"));
try {
startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(EmailHtmlActivity.this, "There are no email clients installed.",Toast.LENGTH_SHORT).show();
}
參見[如何以發送HTML的電子郵件(http://stackoverflow.com/questions/2007540/how-to-send-html-email)和[機器人-send-html-mail-using-intent](http://stackoverflow.com/questions/2544141/android-send-html-mail-using-intent) – 2012-02-03 11:16:44
請不要在標題中使用CAPSLOCK ... – WarrenFaith 2012-02-03 11:19:02