Send an Email from App with Android Intent


Send an Email from App with Android Intent

 

    Intent emailIntent = new Intent(Intent.ACTION_SEND);

    // The intent does not have a URI, so declare the “text/plain” MIME type

emailIntent.setType(“text/html”);

emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {“david@google.com”}); // recipients

emailIntent.putExtra(Intent.EXTRA_SUBJECT, “Email subject”);

emailIntent.putExtra(Intent.EXTRA_TEXT, “Email message text…”);

emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(“content://path/to/email/attachment”));

    // You can also attach multiple items by passing an ArrayList of Uris

startActivity(emailIntent);

Log.v(“*** MainActivity ***”,“Intent method called”);

Leave a comment

Your email address will not be published. Required fields are marked *