Integration guide · Astro
Add a contact form to your Astro site — no backend, no JavaScript
Astro ships zero JavaScript by default, and your contact form can too. A plain HTML form pointed at a PostTo endpoint works with fully static output: no SSR adapter, no serverless function, no client-side code.
PostTo receives the POST, filters spam, emails you the submission, and logs it to a searchable dashboard. Your Astro site stays 100% static.
Free plan, no credit card required.
Three steps, a few minutes
Create an endpoint
Sign up free, create an endpoint in the dashboard, and set your destination email. You'll get an endpoint URL right away.
Add the form to a page
Drop a plain HTML form into any .astro page or component and set its action to your endpoint URL. No integration, island, or adapter required.
Build and deploy
astro build produces static output as usual. Submissions land in your inbox and dashboard; the visitor is redirected to your thanks page.
The code
Replace YOUR_TOKEN
with the endpoint URL from your dashboard.
---
// Works with fully static output — no adapter needed.
---
<form action="https://postto.dev/api/v1/send/YOUR_TOKEN" method="POST">
<label for="name">Name</label>
<input type="text" id="name" name="name" required />
<label for="email">Email</label>
<input type="email" id="email" name="email" required />
<label for="message">Message</label>
<textarea id="message" name="message" required></textarea>
<!-- Honeypot: bots fill this in, humans never see it -->
<input type="text" name="_hp" tabindex="-1" autocomplete="off" style="display:none" />
<!-- Where to send the visitor after a successful submission -->
<input type="hidden" name="_next" value="https://yoursite.com/thanks" />
<button type="submit">Send</button>
</form>
Good to know
Fully static — no adapter
This works with Astro's default static output. You don't need the Node, Vercel, or Cloudflare adapter, and you don't need to mark anything as server-rendered.
Success page
The hidden _next field sends the visitor to your own thanks page after submitting. Leave it out and PostTo shows a hosted success page you can customise per endpoint in the dashboard.
Spam protection is already wired in
The hidden _hp field is a honeypot — humans never see it, bots fill it in, and PostTo silently discards those submissions. Server-side baseline filtering (heuristics and optional AI classification) runs on every submission after that, so you don't need a CAPTCHA to start.
From the docs
Frequently asked questions
- Does this work with Astro's static output?
- Yes — that's the point. The form is plain HTML, so it works with output: "static" and needs no SSR adapter or serverless function.
- Can I show an inline success message instead of redirecting?
- Yes. Submit the form with fetch and an Accept: application/json header, and PostTo returns a JSON response you can render inline. The plain-HTML redirect flow needs no JavaScript at all, though.
- How do I stop spam without a CAPTCHA?
- Include the hidden _hp honeypot field shown above. PostTo also runs first-party heuristic filtering on every submission, and you can enable AI classification per endpoint. Cloudflare Turnstile is supported if you want a visible challenge.
- What does it cost?
- The free plan includes 50 submissions per month with the full dashboard — no credit card required. Paid plans start at $9/month.
Add a form to your Astro site today
Create an endpoint, paste the snippet, and see your first submission in the dashboard — all on the free plan.
Try PostTo free