Skip to content

Instantly share code, notes, and snippets.

@huangcd
Created September 26, 2014 05:39
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 huangcd/1ca65c255ea7496219c8 to your computer and use it in GitHub Desktop.
Save huangcd/1ca65c255ea7496219c8 to your computer and use it in GitHub Desktop.
Android send email
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient@example.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT , "body of email");
try {
startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(MyActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment