1. Get a Resend API Key
- Sign up for free at https://resend.com.
- Create an API key from the dashboard.
- Verify your sending domain (or use Resend's shared domain for testing).
Receive an email notification for every new form submission.
npm install resendDeploy this as a serverless function or Node.js endpoint. Your frontend posts here; the handler forwards to Peach Form and sends you an email.
// handler.js — deploy to Vercel, Netlify, or any Node.js server
import { Resend } from "resend";
const resend = new Resend(process.env.RESEND_API_KEY);
export default async function handler(req, res) {
if (req.method !== "POST") {
return res.status(405).end("Method not allowed");
}
const body = req.body; // parsed JSON
// 1. Forward submission to Peach Form
const pfRes = await fetch("https://api.peachform.com/f/YOUR_FORM_ID", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
});
if (!pfRes.ok) {
return res.status(502).json({ error: "Peach Form submission failed" });
}
// 2. Send email notification
const html = Object.entries(body)
.map(([k, v]) => `<p><strong>${k}:</strong> ${v}</p>`)
.join("");
await resend.emails.send({
from: "[email protected]",
to: "[email protected]",
subject: "New form submission",
html: `<h2>New submission</h2>${html}`,
});
return res.status(200).json({ success: true });
}RESEND_API_KEY=re_...After a successful submission you will receive an email like this:
Subject: New form submission
New submission
name: Jane Doe
email: [email protected]
message: Hello!