Being able to prompt a user to send an email in your app is pretty important, especially if you have a settings page. I always try to add some sort of feedback mechanism in apps, because you can actually catch a lot of bad reviews – if users have a place to send you their complaints inside the ‘experience’ sometimes they won’t bother going back to your store listing just to vent. There are some good native wrappers like react-native-mail for sending emails, but if you can find a way to do it without having to link any libraries why not do it that way? After all, especially with React Native, libraries can become a technical debt in the long run.

Send an Email Without Any Native Libraries

It’s pretty painless, in another recent post I talked about using React Native’s Linking API to prompt users to make a tweet. I’m going to introduce the same principle here, expect with mailto. So in one of my Helper classes I have something like this:

Then on my setting screen I use this method with mailto, like this:


This will either open the user’s default email app with the recipient field filled out or give them a chooser to select what app to use if they have no default set. If you wanted to add a subject to the email, like “Feedback” for example, you just need to add a ‘subject’ parameter to the mailto link:

And that’s pretty much all there is to it, you can do all of this just using the React Native standard libraries. Maybe in the future there will be an even easier way to do this without having to use mailto links.

A Word on Libraries

I have no issue with libraries at all, there are many that I am thankful to use in my projects but you’re always basically at the mercy of the author’s updates. If it’s a React Native Community library that’s not such a big issue, but there have been a few times where my projects have broken from updating the React Native version(the release cycle is very fast) or upgrading my Android Project’s gradle version etc. I believe one day React Native will get to a point where you can do almost anything without relying on wrappers or external libraries, but it’s not a point we’ve reached yet. Expo is our shining hope in that regard.