tags:

views:

545

answers:

2

I'm using the following piece of code in Android to send a mail:

 Intent emailIntent = new Intent(Intent.ACTION_SEND);
 emailIntent.setType("text/html");
 emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,sendTo );

 emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "test" );
 emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "msg" );

When code is compiled and run, its asking me options of selecting applications like "GMail", "BlueTooth" etc. But I want the mail to be sent without user intervention. Even sending it by MMS will be much better for me. Can some one suggest me how to do it?

+2  A: 
Dave.B
Android already has "GMail" app. How can I use the same account to send a mail instead of alerting user to provide those details?
Satyam svv
I *guess* you can't: either you ask user's password, or you ask gmail app to send the mail for you.
Lo'oris
assuming the user has their credentials stored in the gmail app you may be able to retrieve them via a content provider if they are exposed. Otherwise you have to either ask for credentials or use a gmail account which you've set up for your application to send mail. I use the above class to report uncaught exceptions.
Dave.B
+1  A: 

You can't send an email or sms using the built-in apps without user intervention. You have to use an external mail library like the other answer mentions.

BrennaSoft