2

Trying to add hyperlink with email intent, but on other side i got nothing just plain text. If i use gmail client application, this works great but not with default email app(device inbuid app).

here is my code snipt

 Intent emailIntent = new Intent(Intent.ACTION_SEND);
 emailIntent.setData(Uri.parse("mailto:"));
 emailIntent.setType("plain/text");
 emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{"abc@gyc.com","aaa@bbb.com"});
 emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Check this out!");
 emailIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml("<a href=\"www.google.com\">link</a>"));
 startActivityForResult(emailIntent,Util.EMAILREQUESTCODE);

please check this screenshot

Hashir Sheikh
  • 1,811
  • 1
  • 14
  • 14

1 Answers1

0

Set the type as "text/html" i.e. emailIntent.setType("text/html");

Manish Mulimani
  • 17,535
  • 2
  • 41
  • 60
  • if i use gmail application to send email, this works perfectly. but if i use default email app, it send email as plain text – Hashir Sheikh Apr 03 '14 at 12:16
  • do you know something about this question @vorrtex? – Hashir Sheikh Apr 03 '14 at 12:41
  • @HashirSheikh Such question was already asked http://stackoverflow.com/questions/2007540/how-to-send-html-email, you probably should use `ACTION_SENDTO` instead of `ACTION_SEND` – vortexwolf Apr 03 '14 at 12:56
  • @vorrtex this not working for me, but this reduce application in intent chooser, now only email supported application is visible in intent chooser. – Hashir Sheikh Apr 03 '14 at 13:26
  • i think 'it works with gmail,the standard Android Mail app just drops the HTML formatting including links' – Hashir Sheikh Apr 03 '14 at 13:28
  • @HashirSheikh Does it work for bold/italic tags? What happens if you send to the intent a plain text without calling `fromHtml`? – vortexwolf Apr 03 '14 at 15:20
  • @vorrtex, if i send only plain text message is show up like this "link", The link you mention here is give same result as my code except application filter (now only email client application is visible :) ), But not solve my problem :( – Hashir Sheikh Apr 04 '14 at 04:57