Created
August 6, 2016 07:15
-
-
Save mahdimortazavi/c092210b173fb93bfad0b374cbf419d1 to your computer and use it in GitHub Desktop.
send Email by Email app
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
private void sendEmail(){ | |
Intent emailIntent = new Intent(Intent.ACTION_SENDTO); | |
emailIntent.setData(Uri.parse("mailto:" + "[email protected]")); | |
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "My email's subject"); | |
emailIntent.putExtra(Intent.EXTRA_TEXT, "My email's body"); | |
try { | |
startActivity(Intent.createChooser(emailIntent, "Send email using...")); | |
} catch (android.content.ActivityNotFoundException ex) { | |
Toast.makeText(Activity.this, "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