feat: ContactUs Form

This commit is contained in:
Dex-404 2024-04-22 00:01:07 +05:30
parent 88c7d2e2c1
commit 488177b640
9 changed files with 844 additions and 38672 deletions

19
app/api/routes/route.ts Normal file
View file

@ -0,0 +1,19 @@
import { mailOptions, transporter } from "./mailTransporter"
import { NextResponse } from "next/server"
export async function post(req: any) {
const data = await req.json()
try {
await transporter.sendMail({
...mailOptions,
subject: data.subject,
text: `Email: ${data.email}\n\n${data.message}`,
})
return NextResponse.json({ success: true })
} catch (error: any) {
console.error(error)
return NextResponse.json({ error: error.message }, { status: error.status })
}
}