Home > Back-end >  React Native Forms Handling on Submit Button
React Native Forms Handling on Submit Button

Time:11-25

I am new to React Native. I am building an app where there is a contact form in it. I want to collect all the forms field data and want to send these details entered by the users to a specific email on clicking Submit button. How can I achieve this? Thanks In advance

CodePudding user response:

Am not sure if you can send email directly from react native app directly.

You can try using react-native-email package. Its quite easy to integrate. The package uses Linking API

import email from 'react-native-email'//imports the package

handleEmail = () => {//function to send email
    const to = ['[email protected]', '[email protected]'] // string or array of email addresses
    email(to, {
        // Optional additional arguments
        cc: ['[email protected]', '[email protected]'], // string or array of email addresses
        bcc: '[email protected]', // string or array of email addresses
        subject: 'Show how to use',
        body: 'Some body right here'
    }).catch(console.error)
}

}

  • Related