Mihir Shah
Mihir Shah

Reputation: 1809

How to send email with html text with 3 columns from android application?

I have searched a lot to send html text using in gmail, but as gmail not support any advance tags, How to send email in table format from android? any way to align text as column using or any other tag?

I want to send email in below format:

c11   c12   c13
c21   c22   c23
c31   c32   c33 

.... ... ... ....

When I send this type email from ios, it works, and it also display column wise in android gmail. Then it's not possible to send from android?

Upvotes: 0

Views: 275

Answers (1)

Shane
Shane

Reputation: 758

Use the following code :

final Intent mEmailIntent = new Intent(android.content.Intent.ACTION_SEND);
    mEmailIntent.setType("application/text");
    mEmailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"[email protected]"});
    mEmailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
    mEmailIntent.putExtra(Intent.EXTRA_TEXT,Html.fromHtml(new StringBuilder()
                                    .append("<b>c11 &nbsp c12 &nbsp c13</b><br>")
                                    .append("<b>c21 &nbsp c22 &nbsp c23</b><br>")
                                    .append("<b>c31 &nbsp c32 &nbsp c33</b><br>")
                .toString()));
    startActivity(Intent.createChooser(mEmailIntent, "Please choose an option to send mail : "));

Hope this will help you...

Upvotes: 1

Related Questions