This worked for me.  I wrote my file to the sdcard.

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse
("file://"+Environment.getExternalStorageDirectory()+"/data.csv"));
sendIntent.setType("text/csv");


On Jan 12, 12:19 pm, Marklar <[email protected]> wrote:
> Hello,
>
> I've been trying to send a file as anemailattachment. My program
> creates the file (a .csv file), and attempts to send it using a mail
> client, like the gmail client. I have gotten as far as Gmail opening
> up with the correct Subject and what appears to be the file attached
> to it but when I send theemail, it arrives with noattachment. This
> is the code snippet I am using:
>
> Intent i = new Intent(Intent.ACTION_SEND);
> i.putExtra(Intent.EXTRA_SUBJECT, filename);
> i.putExtra(Intent.EXTRA_STREAM, Uri.parse("content://
> com.marklar.business/mimetype/sdcard/Accounts.csv"));
> i.setType("text/csv");
> startActivity(Intent.createChooser(i, "Emailfile"));
>
> I have seen two other programs that can add attachments to the gmail
> client, Open Intents File Manager and Voice Recorder. Open Intents was
> even nice enough to open up the source, but after looking through it I
> cannot see any differences between what I am doing and how they send
> attachments. Even the Gmail screen looks identical between all three
> programs, with theattachment, subject etc, but theirs actually send
> theattachmentwhereas mine just sends the subject and body of theemail.
>
> I've spent the last couple of days searching this group, on Google and
> asking on IRC, if anyone has any ideas I would greatly appreciate it.
>
> Thanks!
> Marklar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to