Email mark.mullings@blackdice.ai on every toolkit submission

Adds an SMTP-based notification (server/mailer.js) that fires whenever
a visitor registers or downloads an ROI report, configured via
NOTIFY_EMAIL/SMTP_* env vars.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-19 16:23:31 +05:00
co-authored by Claude Sonnet 5
parent 214efa2bce
commit 28041e6d15
6 changed files with 89 additions and 2 deletions
+2
View File
@@ -2,6 +2,7 @@ import 'dotenv/config';
import cors from 'cors';
import express from 'express';
import { pool } from './db.js';
import { notifySubmission } from './mailer.js';
const app = express();
@@ -35,6 +36,7 @@ app.post('/api/webhook', async (req, res) => {
} else {
return res.status(400).json({ ok: false, error: `Unknown event: ${event}` });
}
notifySubmission({ event, lead, roi, submittedAt }).catch((err) => console.error('[mail] notify failed:', err));
res.json({ ok: true });
} catch (err) {
console.error('[db] write failed:', err);