Miracle
Miracle

Reputation: 36

How to send an email to user email account in android

4 Text-views and one button are present in my app screen. how can i send the data present in that text-views as an email to user account.

Upvotes: 1

Views: 156

Answers (1)

Swayam
Swayam

Reputation: 16354

    Intent email = new Intent(Intent.ACTION_SEND);
    email.putExtra(Intent.EXTRA_EMAIL, new String[]{"[email protected]"});          
    email.putExtra(Intent.EXTRA_SUBJECT, "subject");
    email.putExtra(Intent.EXTRA_TEXT, "message");
    email.setType("message/rfc822");


try {
    startActivity(Intent.createChooser(email, "Choose an Email client :"));
    } 
catch (android.content.ActivityNotFoundException ex) {
    Toast.makeText(MyActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}

For a detailed explnation, have a look at this tutorial.

Upvotes: 3

Related Questions