从用户输入的电子邮件发送电子邮件

send email from the email entered by the user

如果用户从我的应用程序发送电子邮件,它应该在电子邮件的“发件人”字段中显示用户的电子邮件 ID。我在 React Native 工作。请说出任何可以做到这一点的技术或服务以及如何做到这一点。

假设应用程序需要在用户设备上打开客户端电子邮件应用程序 (android & ios)。

React native 的核心是提供一个链接库,用于与外部应用程序进行深度链接。

  const sendMail = async () => {

    try {

       const recipient = "bill@microsoft.com"
       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);
    }
  };


该函数将打开电子邮件客户端应用程序并将 emailtitlebody 参数传递给电子邮件客户端。

https://reactnative.dev/docs/linking

探索更多