Created
November 28, 2012 12:31
-
-
Save JafarKhQ/4160927 to your computer and use it in GitHub Desktop.
Send Email Intent
This file contains hidden or 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 sendEmailIntent = new Intent(Intent.ACTION_SEND); | |
sendEmailIntent.setType("plain/text"); // "plain/text" != "text/plain" | |
sendEmailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "subject"); | |
sendEmailIntent.putExtra(Intent.EXTRA_TEXT, "body"); | |
sendEmailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, | |
new String[] { "[email protected]" }); | |
// startActivity(sendEmailIntent); OR | |
startActivity(Intent.createChooser(sendEmailIntent, "send using…")); |
This file contains hidden or 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 sendEmailIntent = new Intent(Intent.ACTION_SENDTO); | |
String uriText = "mailto:[email protected]" + | |
"?subject=the subject" + | |
"&body=the body"; | |
uriText = uriText.replace(" ", "%20"); | |
Uri uri = Uri.parse(uriText); | |
sendEmailIntent.setData(uri); | |
startActivity(sendEmailIntent); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment