Skip to content

Instantly share code, notes, and snippets.

@trulymittal
Last active August 31, 2019 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trulymittal/ebdbd32d735002b91efb01364bacd053 to your computer and use it in GitHub Desktop.
Save trulymittal/ebdbd32d735002b91efb01364bacd053 to your computer and use it in GitHub Desktop.
public void sendmail() {
String[] TO_EMAILS = {"emailone@example.com", "emailtwo@example.com"};
String[] CC = {"emailthree@example.com"};
String[] BCC = {"emailfour@example.com"};
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:"));
intent.putExtra(Intent.EXTRA_EMAIL, TO_EMAILS);
intent.putExtra(Intent.EXTRA_CC, CC);
intent.putExtra(Intent.EXTRA_BCC, BCC);
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject of the email.");
intent.putExtra(Intent.EXTRA_TEXT, "Body of the email");
startActivity(Intent.createChooser(intent, "Choose your email client"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment