Android: Sending Email using Intents

ACTION_SENDTO

To start the Activity to compose an email in your user’s favorite email app you use an Intent with the ACTION_SENDTO action. Unfortunately, the documentation is very sparse. It simply states:

mailto:bob@example.org?cc=alice@example.com&subject=Important%20message&body=Hi%20there
Allow users to select a default app

EmailIntentBuilder — Making life easier

The goal of the Email Intent Builder library is to make creating email Intents as easy as possible.
You can find it on Maven Central, the source code on GitHub.

What about Attachments?

Unfortunately, the ACTION_SENDTO Intent doesn’t support attachments. If you need to send an email containing one or more attachments you should use Android’s more generic share mechanism, i.e. ACTION_SEND or ACTION_SEND_MULTIPLE.
A lot of people have realized that this leads to quite a few more than just email apps showing up in the app chooser dialog. How to properly deal with that is material for another post.

--

--

Android developer, open source enthusiast

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
cketti

cketti

Android developer, open source enthusiast