Skip to content
Patchwork
Start free
All docs pages

Docs · Content

Forms

Where the contact form and the newsletter signup send to, and how to connect a provider.

The contact page has a contact form, and the blog a newsletter signup. Both are Velocity’s (ContactForm, NewsletterForm) and submit to Astro Actions in src/actions/index.ts, which check the fields on the server and catch bots with a hidden field.

Until you connect them

Without a way to deliver, a submission is thrown away and the server logs a warning. pnpm check:agent warns about it too. Connect the forms before you publish.

An endpoint

The quickest way is an address that takes a JSON POST, from a form service or your own server. Set it in the environment:

Variable What it receives
CONTACT_FORM_ENDPOINT { name, email, subject, message } for each message
NEWSLETTER_ENDPOINT { email } for each signup
NEWSLETTER_API_KEY Optional: sent as Authorization: Bearer <key> with the newsletter requests

When the endpoint doesn’t answer with a 2xx, the form shows its error message, so a visitor never reads that a message was sent when it wasn’t.

A provider

To send email with Resend, Postmark or another provider, replace the forwarding in src/actions/index.ts with the provider’s SDK. The velocity-connect-forms skill in .agents/skills/ walks through it, with the key kept in astro:env. Keys go in the host’s environment settings, never in the repository.

Test a form with a real send before you call it working.