aspose file tools*
The moose likes Android and the fly likes sending Email with attachment using Android emulator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "sending Email with attachment using Android emulator" Watch "sending Email with attachment using Android emulator" New topic
Author

sending Email with attachment using Android emulator

Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

I have an activity and it wishes to send a file(stored on SD card) as an email attachment.

So , I create an intent with Action = ACTION_SEND :



I populate the "To" and "Subject" fields using Intents "putExtra" methods:


I have the file that I need send as attachment in a FileInputStream, how do I attach it to email?
I think i can attach it using

Will this code work?

I tried running my code and when this logic was triggered an email editor was launched(No subject/ To fields were populated).
Is there a problem with emulator(specifically with its default email client?)

Thanks.




[List of FAQs] | [Android FAQ] | [Samuh Varta]
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

Has any one tried sending an email on the emulator?
Mark L. Murphy
Author
Ranch Hand

Joined: Feb 11, 2009
Posts: 131
Has any one tried sending an email on the emulator?


At minimum, you will need an email application on the emulator (e.g., K9). The tests I have done with sending email were all done on a device, though.


Mark Murphy (a Commons Guy)
Author of The Busy Coder's Guide to Android Development http://commonsware.com/Android/
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

Thanks for your reply Mark..

Do you think i am treading the right path as regards sending email is concerned(can you please skim through the code in the first post)?
Mark L. Murphy
Author
Ranch Hand

Joined: Feb 11, 2009
Posts: 131
Sorry, I haven't tried sending attachments. I think you're on the right track on the rest, though.
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

[I am reviving an old, unanswered thread...]

I need to send out emails and intercept them from my program(or atleast the program should be notified that an email is received).

I have tried sending emails from the emulator but without much luck(I have installed K-9 on my emulator) :|

Moreover, I am thinking of using EXTRA_STREAM to attach files too. Will this work on the real device?

What is the Android-action broadcast by the system when an email is recieved(assuming there is one)?

Thanks.
Ed Burnette
Author
Ranch Hand

Joined: Jun 10, 2003
Posts: 142
See this thread:

http://groups.google.com/group/android-developers/browse_thread/thread/65b4ec9ab8c57112

Ed Burnette, Author of Hello Android
Blog: ZDNet's Dev Connection - Twitter: @eburnette
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sending Email with attachment using Android emulator