Reputation: 3600
I want to be able to send an email out of my app, based on the user pressing a button on my app's Activity. The email needs to be sent automatically by the application upon button press, i.e. I don't want to show another email form to the user. And the email should be sent using the user's default email account on the phone not an email account that I hardcode into my app. And I don't want to have the user key in their email credentials into my app's configuration, I just want to be able to call some android api and say "send this email with this subject and body to this email address, using the default account that the user has set up on the phone".
Is this possible? If so, how?
Upvotes: 4
Views: 11977
Reputation: 40401
To send in the background, see the first link at your right on the list of related questions:
You need to use an email API such as JavaMail:
Sending Email in Android using JavaMail API without using the default/built-in app
Update based on the comments:
There is no way to send an email silently, without either:
And that is a very good thing! There are too many security concerns otherwise. If you ever find a way, please post it as a bug report in android.
Upvotes: 6