0

I apologize if it's a repeated question but the answers that i found doesn't work for me. What i want is to open email Intent with chooser dialog but directly send email using emailClient that i set as default in settings of device:-

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);


                emailIntent.setType("message/rfc822");
                String contactEmail = directoryDetails.getEmail();


                emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{ contactEmail});

                emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "");

                emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "");

                activity.startActivity(emailIntent);

It's using a fixed email that i setup very first one. but not variaying according to default settings. Can anybody say what i am missing in my code.

Suresh Sharma
  • 1,584
  • 19
  • 35
  • see this http://stackoverflow.com/questions/11693566/android-intent-to-open-email-application-from-separate-class – Shruti Oct 15 '13 at 08:07
  • http://stackoverflow.com/questions/6255915/android-intent-chooser-to-only-show-e-mail-option – Shruti Oct 15 '13 at 08:10

1 Answers1

0

try this :-

Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:someone@example.com?subject=" +
    Uri.encode("my subject") +  "&body=" +
    Uri.encode("My big long body with spaces, new lines, and all sorts of invalid URI characters"));
startActivity(intent);
Harshit Rathi
  • 2,213
  • 2
  • 15
  • 25