The contact form and the newsletter signup are Astro Actions in src/actions/index.ts. They send through Resend (src/lib/resend.ts). Set these in .env and at your host:
| Variable | What it is |
|---|---|
RESEND_API_KEY |
Your Resend key |
RESEND_FROM_EMAIL |
The sender, on a domain you verified in Resend; without it, email in site.config.ts is the sender |
RESEND_SEGMENT_ID |
Optional: the segment confirmed subscribers go into |
SITE_URL |
Your site’s address; the newsletter’s confirmation link uses it |
The emails’ words are under contactMail and newsletterMail in the translations.
The contact form
A message goes to email in site.config.ts, with the sender’s address as the reply-to. It isn’t stored on the site.
The newsletter
The signup sits under each blog post (newsletter in the settings). It’s double opt-in: a signup gets an email with a link to /newsletter/, signed and valid for three days, and nothing is stored yet. The address goes into Resend’s contacts only after its owner clicks Confirm on that page (src/pages/api/newsletter.ts). An address that was already a contact is subscribed again.
The rate limit
Every submission, and every click on Confirm, first passes a rate limit (src/lib/rate-limit.ts): five a minute from one connection’s address. The count is kept in the server’s memory, so it holds per server instance; for a site under real pressure, add your host’s own rate limiting in front. When no address can be read, the request is allowed, so real messages aren’t refused.
Without Resend
Without RESEND_API_KEY, CONTACT_FORM_ENDPOINT and NEWSLETTER_ENDPOINT send each submission as JSON to an address of your own; NEWSLETTER_API_KEY, when set, goes with newsletter requests as a Bearer token. A signup sent there is single opt-in unless your endpoint confirms the address itself.
With neither, a live site refuses a submission and the form shows an error, rather than losing the message. In pnpm dev the submission is written to the terminal and dropped, so you can try the forms without a key.
The sign-in form
The form on /login/ isn’t one of these: it posts straight to your app’s own sign-in address, and the site never sees what’s typed. See Settings.
Keep the privacy page in step with what your forms do with personal data: its text is in src/i18n/privacy/<language>.astro.