Untitled
unknown
plain_text
a year ago
619 B
7
Indexable
import { NextResponse } from "next/server"
import { Resend } from "resend"
const resend = new Resend(process.env.RESEND_API_KEY)
export async function POST(request: Request) {
const { name, email, message } = await request.json()
try {
const data = await resend.emails.send({
from: "Kontaktformular <[email protected]>",
to: ["[email protected]"],
subject: "Neue Kontaktanfrage",
text: `Name: ${name}\nEmail: ${email}\nNachricht: ${message}`,
})
return NextResponse.json(data)
} catch (error) {
return NextResponse.json({ error })
}
}
Editor is loading...
Leave a Comment