1
String mailContent = "<b>boldText:</b>"

I tried below also but not working.

String mailContent = "<strong>boldText:</strong>"

Email intent.

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/html");
sendIntent.putExtra(Intent.EXTRA_SUBJECT, 
getResources().getString(R.string.slide3_text1));
sendIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(mailContent));
startActivity(Intent.createChooser(sendIntent, "Send Mail"));

Please check this code not showing bold text in mail. i want to display like below.

Title of Content:

Name

etc...

Title of Content 2:

Name

etc.

Please take look into this and let me know I read many blogs. Thanks in advance.

Zobia Kanwal
  • 4,085
  • 4
  • 15
  • 38
Vaibhav K
  • 43
  • 2
  • 12
  • 1
    THe email app is a completely different app. There's no way to force it to display HTML. It may not even be capable of it. I'm not certain whether styling in spannables is kept when sending data via an Intent. My guess is it isn't. – Gabe Sechan Nov 02 '18 at 05:48
  • fromHtml() is just for your own app TextView's not sure that the shared text will work in every app – Akshay Paliwal Nov 02 '18 at 05:58
  • @AkshayPaliwal yes but need to make sure because in other blogs they have written its possible please check this same. https://stackoverflow.com/questions/41741128/make-text-bold-italic-and-bigger-for-email-body-in-java https://blog.iangclifton.com/2010/05/17/sending-html-email-with-android-intent/ – Vaibhav K Nov 02 '18 at 06:16
  • If you want bold text on Whatsapp then follow this answer https://stackoverflow.com/a/57604994/8360050 – Praveen Kumar Aug 22 '19 at 08:22

2 Answers2

2

As per R&D, I found that this is not possible in new Gmail because Gmail introduces own editor in the mail. Thanks

Vaibhav K
  • 43
  • 2
  • 12
0

You can use Constant Value: "android.intent.extra.HTML_TEXT" along with EXTRA_TEXT

  • or you can do as ' Html.fromHtml(new StringBuilder().append("this is bold").toString)' modify this code as it have some silly errors but it will work also use Intent yourintent= new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:")); –  Nov 02 '18 at 05:58
  • sendIntent.putExtra("android.intent.extra.HTML_TEXT", Html.fromHtml(mailContent)); this way not working. – Vaibhav K Nov 02 '18 at 06:10
  • sendIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(new StringBuilder().append("this is bold").toString())); this way is also not working – Vaibhav K Nov 02 '18 at 06:14
  • have you used Intent yourintent= new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:")); –  Nov 02 '18 at 06:21
  • Not yet, i want to write in the body using this we can set mailto only. i dont know how to set body in your code. – Vaibhav K Nov 02 '18 at 06:29
  • use this emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Email Body"); –  Nov 02 '18 at 06:33
  • As per R&D, I found that this is not possible in new Gmail because Gmail introduces own editor in the mail. Thanks – Vaibhav K Nov 02 '18 at 07:10