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.
To open email client with React Native, we call Linking. openURL to open the email address with the mailto URL. <Button onPress={() => Linking.
Along with the complete version to include in the code: // send-email. js import qs from 'qs'; import { Linking } from 'react-native'; export async function sendEmail(to, subject, body, options = {}) { const { cc, bcc } = options; let url = `mailto:${to}`; // Create email link query const query = qs.
Running your React Native applicationInstall the Expo client app on your iOS or Android phone and connect to the same wireless network as your computer. On Android, use the Expo app to scan the QR code from your terminal to open your project. On iOS, use the built-in QR code scanner of the Camera app.
<Button onPress={() => Linking.openURL('mailto:[email protected]') } title="[email protected]" />
<Button onPress={() => Linking.openURL('mailto:[email protected]?subject=SendMail&body=Description') } title="[email protected]" />
<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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With