import { NextRequest, NextResponse } from "next/server"; export async function POST(req: NextRequest) { const body = await req.json(); const { name, email, subject, message } = body; if (!name || !email || !message) { return NextResponse.json({ error: "Missing fields" }, { status: 400 }); } // Forward to VPS API which handles email delivery // Once email is configured, the VPS API will send to support@verimundsolutions.com try { const res = await fetch(`${process.env.API_URL}/contact`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name, email, subject, message }), }); if (!res.ok) throw new Error("API error"); return NextResponse.json({ ok: true }); } catch { // Log the submission server-side so nothing is lost even if email is not yet set up console.log("[CONTACT SUBMISSION]", { name, email, subject, message, ts: new Date().toISOString() }); return NextResponse.json({ ok: true }); // Still return ok so the user isn't confused } }