Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send email in Android ? [duplicate]

Tags:

android

email

How does one send a simple email message, in code, on Android?

like image 251
Sankar Ganesh PMP Avatar asked Dec 02 '22 05:12

Sankar Ganesh PMP


2 Answers

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"));
like image 167
Sankar Ganesh PMP Avatar answered Dec 05 '22 00:12

Sankar Ganesh PMP


Check out the code at anddev.org for how to do it using intents.

like image 32
Chris Thompson Avatar answered Dec 05 '22 01:12

Chris Thompson