0

IO want to send email in html format in android. I am able to send mail via gmail client but I am not able to get the styles of html of when I use any other client. I have used below code

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();
}
WarrenFaith
  • 57,492
  • 25
  • 134
  • 150
Aamirkhan
  • 5,746
  • 10
  • 47
  • 74
  • see [how-to-send-html-email](http://stackoverflow.com/questions/2007540/how-to-send-html-email) and [android-send-html-mail-using-intent](http://stackoverflow.com/questions/2544141/android-send-html-mail-using-intent) – Francesco Vadicamo Feb 03 '12 at 11:16
  • 1
    Please don't use CAPSLOCK in title... – WarrenFaith Feb 03 '12 at 11:19

1 Answers1

0

try this I am not sure but it may be help you..

startActivity(Intent.createChooser(new Intent(Intent.ACTION_SEND).setType("message/rfc822")
.putExtra(Intent.EXTRA_SUBJECT, subject)
.putExtra(Intent.EXTRA_TEXT,Html.fromHtml(new String().concat("YOUR MESSAGE")), 
 "Send your email in:"));

Thanks.

anddev
  • 3,144
  • 12
  • 39
  • 70