← back to Abramsagency
lead form: optional George email notification (env-gated off, routes to known-good inbox to dodge own-domain send-gate)
1ac9fa4235b57d4e736aedef7efa23684e9ce858 · 2026-08-13 11:04:06 -0700 · Steve Abrams
Files touched
Diff
commit 1ac9fa4235b57d4e736aedef7efa23684e9ce858
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Thu Aug 13 11:04:06 2026 -0700
lead form: optional George email notification (env-gated off, routes to known-good inbox to dodge own-domain send-gate)
---
server.js | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/server.js b/server.js
index b6a2c5f..08736ad 100644
--- a/server.js
+++ b/server.js
@@ -6,6 +6,24 @@ const app = express();
const PORT = process.env.PORT || 9788;
const DATA = path.join(__dirname, 'data', 'leads.jsonl');
+// --- Lead notification email (env-gated, OFF by default) ---
+// George's send-gate blocks a form emailing its OWN new-domain info@ (fail-closed),
+// so notifications route to a KNOWN-GOOD inbox, not info@abramsagency.com.
+const LEAD_NOTIFY = process.env.LEAD_NOTIFY === '1'; // flip to 1 to enable
+const LEAD_TO = process.env.LEAD_TO || 'steve@designerwallcoverings.com';
+const GEORGE_SEND = process.env.GEORGE_SEND || 'http://127.0.0.1:9850/api/send';
+async function notify(lead) {
+ if (!LEAD_NOTIFY) return;
+ const body = {
+ to: LEAD_TO,
+ subject: `New AbramsAgency lead: ${lead.name} — ${lead.need}`,
+ text: `Name: ${lead.name}\nEmail: ${lead.email}\nNeed: ${lead.need}\n\n${lead.message}\n\n(${lead.ts})`
+ };
+ try {
+ await fetch(GEORGE_SEND, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
+ } catch (e) { console.warn('[lead] notify failed:', e.message); } // never block the user on notify failure
+}
+
app.use(express.json({ limit: '32kb' }));
app.use(express.static(path.join(__dirname, 'public'), { extensions: ['html'] }));
@@ -29,6 +47,7 @@ app.post('/api/contact', (req, res) => {
return res.status(500).json({ ok: false, error: 'could not save' });
}
console.log(`[lead] ${lead.ts} ${lead.name} <${lead.email}> — ${lead.need}`);
+ notify(lead); // fire-and-forget; env-gated, never blocks the response
res.json({ ok: true });
});
← 4e76bdf liquid-glass motion: always-on staggered light-sweep sheen +
·
back to Abramsagency
·
harden: ensure data/ dir exists on startup (fresh-box safe) a15d282 →