Android – Send email from your Android application – ACTION_SEND intent

By -

The below code can be tested with the real device:

Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822") ;
i.putExtra(Intent.EXTRA_EMAIL, new String[]{"demo_testing@gmail.com"});
i.putExtra(Intent.EXTRA_SUBJECT,"subject Title");
i.putExtra(Intent.EXTRA_TEXT,"Message body description");
startActivity(Intent.createChooser(i, "Select email application"));

But while testing it with an emulator, you need to make correction with:
i.setType("text/plain");

Paresh Mayani

Lazy android developer, exploring the horizon of android development since 7 years, currently working as a Technical Lead - Android at Simform Solutions, India. Former Application Architect at KarConnect. He is the Head/Organizer of Google Developers Group (GDG), Ahmedabad

Loading Facebook Comments ...
Loading Disqus Comments ...