contact email

This commit is contained in:
isaconantonis 2023-08-02 15:16:52 +02:00
parent f4f9e47997
commit 20cc339948
7 changed files with 453 additions and 9 deletions

21
app/api/send/route.ts Normal file
View file

@ -0,0 +1,21 @@
import { NextResponse } from "next/server"
import { Resend } from "resend"
import { EmailTemplate } from "../../../components/Email/EmailTemplate"
const resend = new Resend(process.env.RESEND_API_KEY)
export async function POST(request: Request) {
const res = await request.json()
try {
const data = await resend.emails.send({
subject: res.subject,
from: "onboarding@resend.dev",
react: EmailTemplate(res),
to: "sam.antonis@isacon.be",
})
return NextResponse.json(data)
} catch (error) {
return NextResponse.json({ error })
}
}