Tuesday, 29 January 2013

How to send Email with Attachment Android

// put this code on your on button click

   final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
   emailIntent.setType("plain/text");
   emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"wadghanednyaneshwar@gmail.com"});
   emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Attachment");
   emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///mnt/sdcard/example.txt"));
   emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "gmail.com");

   MainActivity.this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));

No comments:

Post a Comment