Skip to content
Documentation

Connect Astro forms to email

Receive messages from an Astro site while keeping its static deployment. A standard HTML form sends directly to GlueForms, without an Astro server adapter.

Create the Astro page

  1. In GlueForms, open Forms, choose your form and copy its receiving URL. Select your form above, or replace YOUR_FORM_URL in the example.
  2. Create src/pages/contact.astro with the page below, or place its <form> inside your existing Astro layout.
HTML
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Contact us</title>
  </head>
  <body>
    <main>
      <h1>Contact us</h1>
      <form action="YOUR_FORM_URL" method="POST">
        <label>
          Name
          <input name="name" autocomplete="name">
        </label>
        <label>
          Email
          <input name="replyto" type="email" autocomplete="email" required>
        </label>
        <label>
          Message
          <textarea name="message" rows="4" required></textarea>
        </label>
        <button type="submit">Send message</button>
      </form>
    </main>
  </body>
</html>

Build and publish the site as usual. This form posts to its GlueForms URL, so you do not need an Astro Action or a server endpoint to receive it.

After acceptance, the browser opens the thank-you page with status 200, or follows a 303 redirect to the HTTPS URL saved in your form’s settings. With JavaScript, request JSON and show your own confirmation after accepted: true. JSON receipts do not redirect automatically. The replyto field explicitly sets the address for replies to the notification.

Publish the page, submit the form and open the saved message in GlueForms to check the fields and email notification.

Astro component documentation.