diff --git a/.env.example b/.env.example index 9d5ed4a..47006d9 100644 --- a/.env.example +++ b/.env.example @@ -7,4 +7,9 @@ CONTACT_FORM_MODE=dev CONTACT_FORM_RESEND_API_KEY= CONTACT_FORM_FROM_EMAIL= CONTACT_FORM_TO_EMAIL= +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= diff --git a/README.md b/README.md index 92786ab..7c50539 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/components/ContactFormInline.astro b/src/components/ContactFormInline.astro index e37fae2..82ed22d 100644 --- a/src/components/ContactFormInline.astro +++ b/src/components/ContactFormInline.astro @@ -11,6 +11,7 @@ const model = { fieldName: cf.fieldName, fieldCompany: cf.fieldCompany, fieldCountry: cf.fieldCountry, + fieldDepartment: cf.fieldDepartment, fieldEmail: cf.fieldEmail, fieldMessage: cf.fieldMessage, }; @@ -161,6 +162,20 @@ const fieldClass = class={fieldClass} /> +
+ + +