Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply CSS to email body text in Android?

I am sending an email through intent, here I want to set CSS styles to the body of email, I have already referred many questions and answers on Stack and found below code:

Intent intent = new Intent(Intent.ACTION_SEND);
                intent.setType("text/html");
                intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"[email protected]"});
                intent.putExtra(Intent.EXTRA_SUBJECT, "I would like to buy the following");
                intent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body));
                startActivity(Intent.createChooser(intent, "sending mail"));

but this code sets only text in email body and skips my css styles, how do I achieve that? I want to set background color, text size, text color to the email body all through Android intent.

like image 824
Tushar Purohit Avatar asked Feb 03 '26 10:02

Tushar Purohit


1 Answers

Found an answer on this SO post, according to this gmail doesn't support css in Head and Body tag in html.

Also see this link for more about Css support in browsers.

like image 91
Tushar Purohit Avatar answered Feb 06 '26 00:02

Tushar Purohit