programmatically send email with data file attachment

by Genesio » Wed, 10 Dec 2008 03:41:39 GMT

Sponsored Links
 Hello to everybody, i am writing a small program which creates a text
file on the external storage (microSD card).
Now i want to send this small file via email (asking the user which
account to use).

I read the sdk docs and I found that with an Intent and this action
Intent.html#ACTION_SENDTO) I can write an email.
But I cannot find any EXTRA_**** to specify an attachment.

I tried with EXTRA_STREAM and an open FileInputStream pointing to the
txt file, but when I see (for example) gmail popping out (basic email
writing works) there is no attachment in the "pre-built" email.

I know this is possible because I installed an application from the
market (Voice Recorder) that already does it.

I would want to reproduce its behaviour.

P.S. Another way to achieve my goal would be to upload via HTTP the
file to a webserver... maybe it's simpler? anyone can give me an
example or show me a JAVA library that implements this functionality??

Thank you


Other Threads

1. Android Dev Phone 1 - can I gain access to replace/add system fonts ?


I bought the Android Dev Phone 1, to use it to develop apps, and port
my existing Palm OS applications to the Android platform.

Amongst other things, I thought I'd have access to it's internals -
mainly to replace the system fonts with ones including Hebrew
characters - so I can add Hebrew contacts support to my apps.

I cant seem to be able to replace/add the fonts in the system/fonts
directory - since it's read-only.

Is there a way around this on the Dev Phone ?

Thanks in advance.

2. sluggishness of G1 android

i notice that sometimes the os on my G1 starts slowing down.  not sure what
the major causes of that is.  if anyone can point me in the right direction,
it would be much appreicated.


3. Show your tax for G1 Dev Phone?

4. Compile Error(s)

5. SDK 1.0r2 emulator start failed on linux

6. Icons - Recommended size, format, etc?

7. How to highlight the background of a textView