Skip to content Skip to sidebar Skip to footer

How To Send Html Content With Image Through Android Default Email Client?

How can we get inline images in default email client for android through Hypertext Markup Language (HTML) ?

Solution 1:

You can not. As default Email application's doesn't support <img /> tag.

Because, ImageSpan doesn't implementing Parcelable.

Hence its failed with Intent's PUT_EXTRA.

Its works only for basic tags, like, <b>, <i> ..etc

Look at Sending html email in android using <table>, etc. - is there really no relatively built-in Intent way? and How to show an image in the email body?

Solution 2:

String body ="<html><body><table>...</table></body></html>";

IntentemailIntent=newIntent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/html");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body).toString());                    
startActivity(Intent.createChooser(emailIntent, "Email:"));

Unfortunately, the <table>,'img' tag isn't supported. Supported tags are actually more dependent on the email client you use to send the email - some of them are more finicky/restrictive than others. Most of them use the super-basic formatting tags like <b>, <i>, <h1>, and so on, though.

Post a Comment for "How To Send Html Content With Image Through Android Default Email Client?"