Display name
Display name

Reputation: 2747

Mail Intent doesn't show default Mail app

On some phones (HTC Desire S with Gingerbread and Galaxy Nexus) the following intent does not start the default mail client (com.android.mail).

viewIntent = new Intent(Intent.ACTION_SEND);
viewIntent.setType("plain/text");

Is there any way to find out which intent can be used to start the default mai client?

Upvotes: 0

Views: 584

Answers (4)

Display name
Display name

Reputation: 2747

In the end I had to change my intent to using a "mailto:" link instead of using intent extras to make it work on the HTC.

More details can be found here: Only Email apps to resolve an Intent

Upvotes: 0

Hasmukh
Hasmukh

Reputation: 4670

try this way..

Intent emailIntent = new Intent(Intent.ACTION_SEND);
               String toMail[] = {"email id"};
               emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,toMail);
               emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "subject");
               emailIntent.setType("plain/text");
               emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "body");
               startActivity(emailIntent);

Upvotes: 0

Nikhil Lamba
Nikhil Lamba

Reputation: 603

you can use like below :

            Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
            emailIntent.setType("plain/text");

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

Upvotes: 0

njzk2
njzk2

Reputation: 39386

Email correct mime type is message/rfc822. text/plain should work too, but may trigger other handlers. plain/text is incorrect.

Also, ACTION_SENDTO is better if you are passing email addresses as parameters.

Upvotes: 4

Related Questions