I\'m planning to develop an android mobile application using android studio, where an user give email address and secret code. Then that secret code should be send to mentioned
https://developer.android.com/guide/components/intents-common#ComposeEmail
Only email apps
public void composeEmail(String[] addresses, String subject, Uri attachment) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("*/*");
intent.putExtra(Intent.EXTRA_EMAIL, addresses);
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
intent.putExtra(Intent.EXTRA_STREAM, attachment);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
}
Any messaging app:
public void composeEmail(String[] addresses) {
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:")); // only email apps should handle this
intent.putExtra(Intent.EXTRA_EMAIL, addresses);
intent.putExtra(Intent.EXTRA_SUBJECT, "");
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
}