How can I send a mail through an Intent in android?
I would like to send an email with an Intent.
I would like to programatically open up an dialog that shows the different programs that handle this Intent and lets the user show his favourite mail program. In the program I want to specify a Title, an receiver and a message body.
Could yo开发者_JS百科u give me an example on how to this?
Use the code below to send an email via an Intent:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(Intent.EXTRA_EMAIL,new String[] { "address@example.com" });
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject of the mail");
intent.putExtra(Intent.EXTRA_TEXT, "body of the mail");
startActivity(Intent.createChooser(intent, "Title of the chooser dialog"));
精彩评论