Let the contact form deliver to several inboxes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alejandro Veras
2026-10-13 09:46:20 -04:00
parent b3d93d7cbc
commit a259c92cb0
3 changed files with 8 additions and 5 deletions
+6 -3
View File
@@ -4,8 +4,11 @@ import { headers } from "next/headers";
export type ContactState = { status: "idle" | "sent" | "error"; message?: string };
// Where enquiries land. Override with CONTACT_TO in the environment if it ever changes.
const TO = process.env.CONTACT_TO || "rey@aigrowth360.io";
// Where enquiries land. Override with CONTACT_TO (comma-separated for several inboxes) if it ever changes.
const TO = (process.env.CONTACT_TO || "rey@aigrowth360.io")
.split(",")
.map((a) => a.trim())
.filter(Boolean);
// Resend's shared sender only delivers to the address that owns the Resend account. To send to TO
// from any other account, set CONTACT_FROM to an address on a domain verified in Resend
// (e.g. "AI Growth Website <hello@aigrowthtechnologies.com>").
@@ -97,7 +100,7 @@ export async function sendContact(_prev: ContactState, formData: FormData): Prom
try {
await sendEmail(apiKey, {
to: [TO],
to: TO,
reply_to: email,
subject: `New enquiry — ${company || name}`,
text: `${rows.map(([k, v]) => `${k}: ${v}`).join("\n")}\n\n${message}`,