Launch the email intent : Email « Network « Android

Launch the email intent

import android.content.Context;
import android.content.Intent;
import android.os.Build;

class Main {

   * Launch the email intent
   * @param context
   * @param subject
   * @param sendTo
   * @param includeDebug
  public static void launchEmailToIntent(Context context, String subject,
      String sendTo, boolean includeDebug) {
    Uri uri = Uri.parse("mailto:" + sendTo);
    Intent msg = new Intent(Intent.ACTION_SENDTO, uri);

    StringBuilder body = new StringBuilder();
    if (includeDebug) {
          "\n\n----------\nSysinfo - %s\nModel: %s\n\n",
          Build.FINGERPRINT, Build.MODEL));

      // body.append(String.format("\n\nBrand: %s\n\n", Build.BRAND));
      body.append(String.format("%s config -\n", subject));

      // Add locale info
      body.append(String.format("locale: %s\n", context.getResources()

    msg.putExtra(Intent.EXTRA_EMAIL, sendTo);
    msg.putExtra(Intent.EXTRA_SUBJECT, subject);
    msg.putExtra(Intent.EXTRA_TEXT, body.toString());


Related examples in the same category

1.Email vis Intent
2.Builds a list of the recipients email addresses each on a different line
3.Is string an Email address
4.Send email
5.isValidEmailAddress: Check the email address is Valid
6.start Email Intent
7.start Html Email Intent