Created
September 26, 2014 05:39
-
-
Save huangcd/1ca65c255ea7496219c8 to your computer and use it in GitHub Desktop.
Android send email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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