user user - 8 months ago 141
Android Question

Intent.EXTRA_EMAIL not populating the To field

I am trying to use an to send an email from my application but the To field of the email will not populate. If I add code to fill in the subject or text, they work fine. Just the To field will not populate.

I have also tried changing the type to "text/plain" and "text/html" but I get the same problem. Can anyone help please?

public void Email(){

Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("message/rfc822"); //set the email recipient
String recipient = getString(R.string.IntegralEmailAddress);
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL , recipient);
//let the user choose what email client to use
startActivity(Intent.createChooser(emailIntent, "Send mail using...")); }

The email client I'm trying to use is Gmail


I think you are not passing recipient as array of string

it should be like

emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,new String[] { "" });