in Android Code Tips, Programming

Send email with attachment via intent

Tricky to find, simple solution:

File file = new File(path, filename);
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("image/jpeg");
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Photo");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
startActivity(Intent.createChooser(sendIntent, "Email:"));
Share