If a user sends an email from my application it should show the user's email Id in the "from" field of the email. I am working in react native. please name any technology or service which can do so and how.
CodePudding user response:
Assume that the app needs to open up the client email app on the user device (android & ios).
At the core, React native provides a Linking library for deep linking with external apps.
const sendMail = async () => {
try {
const recipient = "[email protected]"
const title = "Acquire Unicorn metaverse start-up";
const body = "Don't lie behind Zuck back. Metaverse is the future..."
const url = `mailto:${recipient}?cc=&subject=${title}&body=${body}`;
await Linking.openURL(url);
} catch (error) {
console.log(error);
}
};
The function will open the email client app and pass email, title, and body parameters to the email client.
Explore more at https://reactnative.dev/docs/linking
