How to launch and open email client React-native?
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.
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'
Note: Not supported in iOS simulator, so you must test on a device.
Unfortunately, none of the answers after are correct.
I do not want to compose an email. I just want to be able to launch the main email app
I would like to have the same behavior:
- Sign-In Screen with a button
Open Email App
- The user opens his email app
- He can click on the magic link to get back in the app
More or less the same as the Slack Onboarding with the magic link.
I found a solution with the library react-native-email-link. You can open an email client from React Native (for 'magic link' type feature).
- Works on Android.
- If you want to try on iOS you need to have a real device because there is no
mail.app
on iOS Simulator.