Aggiunge routing contatti per reparto con endpoint Cloudflare e Resend

Introduce selettore reparto nel form, instradamento verso destinatari dedicati via variabili ambiente e fallback al destinatario generale. Mantiene modalita dev/live e validazione Turnstile lato server.

Made-with: Cursor
This commit is contained in:
Javaxman
2026-04-23 21:12:45 +02:00
parent 5ab329adbf
commit 70759d6c1c
6 changed files with 63 additions and 3 deletions

View File

@ -67,7 +67,12 @@ Server-side (Cloudflare runtime / local `.env`):
- `CONTACT_FORM_MODE` (`dev` or `live`)
- `CONTACT_FORM_RESEND_API_KEY`
- `CONTACT_FORM_FROM_EMAIL` (verified sender in Resend)
- `CONTACT_FORM_TO_EMAIL` (recipient inbox or alias)
- `CONTACT_FORM_TO_EMAIL` (default recipient inbox or alias)
- `CONTACT_FORM_TO_EMAIL_PRIVACY`
- `CONTACT_FORM_TO_EMAIL_SECURITY`
- `CONTACT_FORM_TO_EMAIL_ETHICS`
- `CONTACT_FORM_TO_EMAIL_LEGAL`
- `CONTACT_FORM_TO_EMAIL_HR`
- `CONTACT_TURNSTILE_SECRET_KEY`
Mode behavior:
@ -75,4 +80,10 @@ Mode behavior:
- `dev`: accepts form and logs payload server-side (no real email send)
- `live`: verifies Turnstile (if secret configured) and sends via Resend API
Department routing:
- the contact form includes a department selector
- if a department-specific env is set, the email is routed to that recipient
- otherwise it falls back to `CONTACT_FORM_TO_EMAIL`
Copy `.env.example` to `.env` for local development and configure the same keys in Cloudflare Pages/Workers for production.