1

trying to create an email intent which contains a few links with text

    String emailText = "Hey, click me <a href=\"https://www.google.com\">This is a google link</a>";

    Intent emailIntent = new Intent(Intent.ACTION_SENDTO);

    emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    emailIntent.setType("*/*");
    emailIntent.setData(Uri.parse("mailto:"));
    emailIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(emailText));

If i open the intent with the GMAIL app, it will display the html contents correctly. But if i open it the google Inbox app the html parts are ignored.

Any ideas how to display html in all email clients?

Arthur
  • 3,636
  • 5
  • 19
  • 25
  • Maybe it could be an character encoding problem... – madx Feb 11 '15 at 13:06
  • You could try with `emailText = StringEscapeUtils.escapeHtml4(emailText)`, using this [library](http://mvnrepository.com/artifact/org.apache.commons/commons-lang3/3.3.2): add compile 'org.apache.commons:commons-lang3:3.2' in your build.gradle and let me know! – madx Feb 11 '15 at 13:08
  • When you say that html parts are ignored do you mean that Inbox does an html unwrapping or simply that doesn't show the text "This is a google link"? – madx Feb 11 '15 at 13:32
  • @madx I tried this method but it displayed the html tags as plain text. When i say that the html tags are ignored, i mean that it displays just the "This is a google link" without any html tags(not even plain text) – Arthur Feb 11 '15 at 18:20
  • Found any solution ? – Arslan Anwar Mar 11 '16 at 12:44

0 Answers0