2

How can I start Android's email application (com.android.email)?

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
Gustavo
  • 43
  • 1
  • 6
  • 1
    This post looks like a duplicate of http://stackoverflow.com/questions/2734749/opening-an-email-client-on-clicking-a-button – julian Apr 20 '12 at 04:07

4 Answers4

2

you can start through intent

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "your@email.com" });
intent.putExtra(Intent.EXTRA_SUBJECT, "YOUR SUBJECT");
intent.putExtra(Intent.EXTRA_TEXT, "YOUR MAIL BODY");
startActivity(Intent.createChooser(intent, ""));
julian
  • 381
  • 1
  • 7
2

Since you need to launch a package this should be the solution you are looking for:

Intent intent = getPackageManager().getLaunchIntentForPackage("com.android.email");
startActivity(intent);
MataMix
  • 3,276
  • 10
  • 39
  • 58
1

I think this is useful for u to open the email application.

Intent mailClient = new Intent(Intent.ACTION_VIEW);
mailClient.setClassName("com.google.android.gm", "com.google.android.gm.ConversationListActivity");
mailClient.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(mailClient);
Chris
  • 1,311
  • 2
  • 15
  • 37
  • The package on my tablet is different: `mailClient.setClassName("com.sec.android.app.latin.launcher.email", "com.sec.android.app.latin.launcher.email.Launcher");` – Gustavo Apr 23 '12 at 13:39
0

Use following intent to start email application on android device:

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

String[] recipients = new String[]{"a@email.com", "",};

emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, recipients);

emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Test");

emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "This is email's message");

emailIntent.setType("text/plain");

startActivity(Intent.createChooser(emailIntent, "Send mail..."));
jeet
  • 29,001
  • 6
  • 52
  • 53