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
( http://code.google.com/android/reference/android/content/ 
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
Genesio


--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Make entire screen disabled

Hi All,

When I click on a button i want to make entire screen disabled ... i.e there
are other buttons and text area ..which should get disabled ...on
a particular button click ..is it possible ??

-- 

2. TaskAffinity causes new instance being created when startActivity

Can anybody help me?

-- 

3. App not showing in Market - 2.1, not copy protected

4. ContentProvider to Spinner results in blank, not empty, list

5. Download A file

6. OOT WTA : setting MIFI

7. Advanced map live wallpaper