I am developing an android application that can send email. This following code lets me send email from my default gmail app on android device. I was wondering what the classes i should set so that i can send email from default android mail application?
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setClassName("com.google.android.gm","com.google.android.gm.ComposeActivityGmail");
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "abc@gmail.com" });
sendIntent.setData(Uri.parse("abc@gmail.com"));
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "enter subject");
sendIntent.setType("plain/text");
sendIntent.putExtra(Intent.EXTRA_TEXT, "Insert text");
startActivity(sendIntent);
You don't have to. I am using following to send an email with default mail service.
Uri uri = Uri.parse("mailto:info@yourcompany.com");
Intent myActivity2 = new Intent(Intent.ACTION_SENDTO, uri);
myActivity2.putExtra(Intent.EXTRA_SUBJECT,
"Customer comments/questions");
startActivity(myActivity2);