4

I want to send HTML content via email. I open gmail via intent and shows compose page using below code.

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/html");
emailIntent.setPackage("com.google.android.gm");                    
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "subject here");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml("html <b>content</b>"));
startActivity(Intent.createChooser(emailIntent, "Email to Friend"));

But the problem with this is that, I cant send inline images. How can do that?

Umakant Patil
  • 2,227
  • 6
  • 32
  • 58

1 Answers1

0

All you need:

Community
  • 1
  • 1
Cristian
  • 198,401
  • 62
  • 356
  • 264
  • 1
    I dont want to attach the image. I want the images to be inline in the email. :( – Umakant Patil Jan 13 '11 at 12:37
  • 1
    Ahh now I get it. Sorry, it's not possible. At least it's not easy. I tried a long time to do so and it really depends on the email client installed on the phone, which does not support that. – Cristian Jan 13 '11 at 14:21
  • 1
    The reason: Html.fromHtml() cannot handle images. So it converts all images in the HTML (imgs) into place holder images. If you want it to handle images, lookup the other signature of Html.fromHtml() which takes an ImageGetter. You have to specify your own Image fetch logic here. I have been trying to achieve the same thing and have been primarily unsuccessful! – Vikram Bodicherla Aug 10 '11 at 06:51
  • 2
    This doesnt answer the question of attaching an image inline – Totic Dec 30 '11 at 19:02