Build a contact form with Astro and Resend 0 ▲ Phil Nash 1 hour ago · 8 min read1519 words · Tech · hide · 0 comments I try to keep my email address from appearing on public websites to avoid spam. But I do like people to be able to contact me if they have something I might be interested in. The solution for this? A contact form! This site is mostly statically generated, but as it is currently built with Astro and hosted on Cloudflare Workers, I can designate an endpoint as dynamic, use it to accept a form submission, validate the data on the server, and send it to my email inbox using Resend. In this post, I’ll show you how I built it. What it does When you visit /contact, the Astro framework renders an HTML page with a form on it containing three inputs: the user’s email address, a subject, and the message they want to send. When the user fills in the form and submits it, the browser makes a POST request to the same URL, and the server-side code kicks in. It extracts the details from the form, validates the data, and uses the Resend API to send a message to my email address. If the user didn’t… No comments yet. Log in to reply on the Fediverse. Comments will appear here.