Reputation: 4736
I am designing an app in which the data is stored in the database. There's a button in the form which is on clicked to send an email to pre defined mail address with the data that is stored in the database. Since i am a newbie to android i need help regarding sending the mail... So please help me...
Upvotes: 1
Views: 670
Reputation: 23169
final Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{someEmailAddressString});
intent.putExtra(Intent.EXTRA_SUBJECT, someSubjectString);
intent.putExtra(Intent.EXTRA_TEXT, someEmailContentString);
startActivity(intent);
This will open the email application with an email prepared with the above details. The user just has to hit 'send' to send the mail, then they'll be sent back to your app. This approach doesn't require any permissions in your application, and has good privacy implications because the user can see the mail before sending and has a record of it.
Upvotes: 4