How to launch and open email client React-native?

jasan picture jasan · Jun 16, 2017 · Viewed 62.1k times · Source

I do not want to compose an email. I just want to be able to launch the main email app on a user's device (iOS& Android) from a react-native app.

Scenario: I will send a verification email to the user upon signup.

Answer

Vishal Vaghasiya picture Vishal Vaghasiya · Feb 27, 2018

React Native Open Mail Function

<Button onPress={() => Linking.openURL('mailto:[email protected]') }
      title="[email protected]" />

React Native Open Mail Function With Subject and Body

<Button onPress={() => Linking.openURL('mailto:[email protected]?subject=SendMail&body=Description') }
      title="[email protected]" />

React Native Open URL

<Button onPress={() => Linking.openURL('https://www.google.co.in/') }
      title="www.google.co.in" />

Don't forget to import

import { Linking } from 'react-native'