Reputation: 153
I want to send a mail when user clicks a button and also i should not get any interaction after that and mail should be sent automatically using email client in the mobile.
Please help me to find the solution.
Thanks in advance.
Upvotes: 3
Views: 8655
Reputation: 48622
Simply it is not possible to send the email through email client like Gmail without user interaction.
Instead of Java Mail API, I recommend you to make any Web API in PHP and code there to send the mail and call this Web API in your Android code.
Upvotes: 0
Reputation: 2823
I agree with @TGMClains if u want that there is no user interaction with the mail client in the phone then you need to create your own email client ...check out this following post.
Sending Email in Android using JavaMail API without using the default/built-in app
Hope this solves your problem
Upvotes: 2
Reputation: 2082
In your onClick()
put this :
startActivity(new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:[email protected]"));
Upvotes: 0