bwicks bwicks - 4 months ago 17
Android Question

Does Android's ACTION_SEND Intent have a mechanism to specify the recipient's name?

I am using this Intent to open the device's e-mail client:

Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{"someLongAndUglyEmailAddress@example.com"});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");


Is there an Extra to specify the recipient's actual name?

Answer

There no extra for that from the doc https://developer.android.com/guide/components/intents-common.html#Email

That's the maximum that you can do to compose a new email

public void composeEmail(String[] addresses, String subject, Uri attachment) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("*/*");
    intent.putExtra(Intent.EXTRA_EMAIL, addresses);
    intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    intent.putExtra(Intent.EXTRA_STREAM, attachment);
    if (intent.resolveActivity(getPackageManager()) != null) {
        startActivity(intent);
    }
}
Comments