How does one send a simple email message, in code, on Android?
Asked
Active
Viewed 1.8k times
3 Answers
15
Intent sendIntent;
sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Test Subject");
sendIntent.putExtra(Intent.EXTRA_TEXT, "Test Text");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + fileName));
sendIntent.setType("image/jpeg");
startActivity(Intent.createChooser(sendIntent, "Send Mail"));

Jacob Marble
- 28,555
- 22
- 67
- 78

Sankar Ganesh PMP
- 11,927
- 11
- 57
- 90
-
3It needs : sendIntent.setType("message/rfc822"); – Frank Nguyen Aug 26 '13 at 04:30
4
Check out the code at anddev.org for how to do it using intents.

Chris Thompson
- 35,167
- 12
- 80
- 109
-
Thanx Chris Thompson i posted the code that works fine for me – Sankar Ganesh PMP Aug 27 '10 at 15:28
0
If you don't want to use the User interface for sending mails, check this link: Sending Email in Android using JavaMail API without using the default/built-in app