Sorry for not responding earlier. This worked for me: public static void sendFile(Context context) { String emailPreference = PreferenceManager.getDefaultSharedPreferences(context).getString("emailPreference", ""); String subjectPreference = PreferenceManager.getDefaultSharedPreferences(context).getString("subjectPreference", ""); String bodyPreference = PreferenceManager.getDefaultSharedPreferences(context).getString("bodyPreference", ""); if(subjectPreference.length() == 0) { subjectPreference = (String) context.getText(R.string.csv_subject); } String csvFile = getFilename(); File file = new File(csvFile); if(file.exists()) { Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {emailPreference}); sendIntent.putExtra(Intent.EXTRA_SUBJECT, subjectPreference); sendIntent.putExtra(Intent.EXTRA_TEXT, bodyPreference); sendIntent.setType("text/csv"); sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(csvFile))); context.startActivity(Intent.createChooser(sendIntent, context.getText(R.string.csv_send))); } else { Util.displayToast(context, R.string.no_csv_file); } }
On Apr 14, 10:18 am, Scout Ma <scoutma2...@gmail.com> wrote: > Thanks for your help. > I want to write an application which will send email with an > attachment through GMail on Android. > But I don't have much time to study the basic of JavaMail. > So, I wonder is there any sample for me to get in quickly. > > 2010/4/14 Kumar Bibek <coomar....@gmail.com> > > So, you want to learn how to create an email app? It depends actually > on the protocol that you want to work with. For POP and IMAP, there > are libraries which you have to use. Check out Java Mail API for this. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en