Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 892
jasan Avatar asked Jun 16 '17 17:06

jasan


People also ask

How do I open my email app in React Native?

To open email client with React Native, we call Linking. openURL to open the email address with the mailto URL. <Button onPress={() => Linking.

How do I send an email from React Native app?

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.

How do I open React Native app?

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.


Video Answer


1 Answers

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.

like image 67
Vishal Vaghasiya Avatar answered Sep 25 '22 02:09

Vishal Vaghasiya