feat: wire up email sending for configurator submissions
All checks were successful
Build & Push / build-and-push (push) Successful in 1m22s
All checks were successful
Build & Push / build-and-push (push) Successful in 1m22s
- Created src/lib/email.ts with Nodemailer + Poste.io SMTP - sendBriefToClient: formatted HTML brief email to the lead - sendLeadNotification: admin notification with submission details - Emails fire non-blocking (don't delay the brief response) - Only sends if SMTP_HOST and SMTP_PASS are configured Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { sendBriefToClient, sendLeadNotification } from '@/lib/email';
|
||||
|
||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -206,6 +207,29 @@ export async function POST(request: NextRequest) {
|
||||
// Generate the brief
|
||||
const brief = generateMockBrief(body);
|
||||
|
||||
// Send emails (non-blocking — don't fail the response if email fails)
|
||||
if (process.env.SMTP_HOST && process.env.SMTP_PASS) {
|
||||
Promise.allSettled([
|
||||
sendBriefToClient({
|
||||
to: body.email,
|
||||
name: body.name,
|
||||
company: body.company,
|
||||
brief,
|
||||
}),
|
||||
sendLeadNotification({
|
||||
to: body.email,
|
||||
name: body.name,
|
||||
company: body.company,
|
||||
brief,
|
||||
services: body.services,
|
||||
email: body.email,
|
||||
}),
|
||||
]).catch(() => {
|
||||
// Silently log — don't break the user flow
|
||||
console.error('Email sending failed');
|
||||
});
|
||||
}
|
||||
|
||||
return NextResponse.json({ success: true, brief });
|
||||
} catch {
|
||||
return NextResponse.json(
|
||||
|
||||
Reference in New Issue
Block a user