Matterway
    Preparing search index...

    Function getMailtoLink

    • Generates a mailto: link and programmatically clicks it to open an email client

      Parameters

      • options: { subject: string; to: string[]; text: string }

        The email options

        • subject: string

          The email subject

        • to: string[]
        • text: string

          The email text

      Returns string

      Will throw an error if the URL-encoded mailto link exceeds 2000 characters

      const recipients = ["user1@example.com", "user2@example.com"],
      const subject = "Hello",
      const text = `
      Hello,

      This is a test email.
      `
      const mailtoLink = getMailtoLink({recipients, subject, text});