Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has Android's Gmail app removed the ability to send HTML emails via Intent?

I would like to send HTML emails via an Intent. It seems that the accepted way to do this is as follows:

String body = "I am <b>bold text</b> and I am <i>italic text</i> and I am normal text.";

final Intent emailIntent = new Intent(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));
startActivity(Intent.createChooser(emailIntent, "Email:"));

This does not work in Gmail v6.11.2 and 7.1.129 and produces plain text output. The only tags I see recognized are <p> and <br>.

My email must be editable by the user, so sending it in background via JavaMail API is not an option.

I have also attempted: emailIntent.setType("message/rfc822");

and: emailIntent.putExtra(android.content.Intent.EXTRA_HTML_TEXT, "Hello I am <b>bold</b> text.");

If this was once working, can someone confirm that this is a regression in the Gmail app's functionality as suggested by this user: https://stackoverflow.com/a/41596827/1319081, or am I doing something wrong?

like image 810
rustyWhitefeather Avatar asked Feb 22 '17 04:02

rustyWhitefeather


People also ask

How to send an email using intent in Android?

How to send an Email using Intent in Android? 1 Action in your Intent –#N#So, to create an email intent, you need to use the action as ACTION_SEND. 2 Data you need to pass –#N#The data you pass along with the intent should be an intent object. For this, you can use the... 3 Set Type of your intent – More ...

How to send an email in Gmail?

Now, you need to run your application. Now here, you need to enter the recipient email, subject and body of the mail. Now click on the send email button. Now here you select your mail application. In my case, I will select Gmail. So you can see in your Gmail application along with your recipient mail, subject and mail body.

Is it difficult to send HTML emails via Gmail?

As you can see, sending HTML emails via Gmail isn’t difficult at all. The tricky part might be to display them properly in the vast array of browsers and email clients. With a bit of practice and the appropriate toolset, it shouldn’t cause a problem too.

Does Newton Mail work with Gmail?

Newton Mail isn't a traditional email client but a subscription-based email service designed to make email organization easier. It works with Gmail, Exchange, Yahoo Mail, Hotmail/Outlook, iCloud, Google Apps, Office 365, and all IMAP accounts.


1 Answers

String body = new String("<html><body><table><tr><td><br/>" +header+"</td></tr><br/><br/>"+"Get <b> Best Score </b> in your Android Phone.<br/>"+"<a href=\"" + link_val + "\">" + text_value+ "</a>");

emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, html.fromHtml(body));

Android support only some Tag.. For more information check below link..

Link 1

Link 2

like image 196
Anchal Singh Avatar answered Oct 17 '22 22:10

Anchal Singh