[object Object]

← back to Commercialrealestate

CRCP email-alerts: fix George send (/api/send + body field) + wire token from george-gmail/.env

035640a594d00acf0c956f967687caea52090bcf · 2026-07-12 11:09:15 -0700 · Steve

Files touched

Diff

commit 035640a594d00acf0c956f967687caea52090bcf
Author: Steve <steve@designerwallcoverings.com>
Date:   Sun Jul 12 11:09:15 2026 -0700

    CRCP email-alerts: fix George send (/api/send + body field) + wire token from george-gmail/.env
---
 scripts/email-alerts.js     | 4 ++--
 scripts/run-email-alerts.sh | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/email-alerts.js b/scripts/email-alerts.js
index 9825fcb..5a3257c 100644
--- a/scripts/email-alerts.js
+++ b/scripts/email-alerts.js
@@ -168,8 +168,8 @@ function georgeSend({ to, subject, html, from }) {
     const base = process.env.GEORGE_URL || 'http://127.0.0.1:9850';
     const token = process.env.GEORGE_EXTERNAL_SEND_TOKEN || '';
     if (!token) return reject(new Error('GEORGE_EXTERNAL_SEND_TOKEN not set — external send blocked (fail-closed)'));
-    const payload = JSON.stringify({ to, subject, html, from, account: 'steve-office' });
-    const u = new URL(base + '/send');
+    const payload = JSON.stringify({ to, subject, body: html, from, account: 'steve-office' });
+    const u = new URL(base + '/api/send');
     const lib = u.protocol === 'https:' ? https : http;
     const req = lib.request(u, { method: 'POST', headers: {
       'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload),
diff --git a/scripts/run-email-alerts.sh b/scripts/run-email-alerts.sh
index a8ef8fd..6a342b4 100644
--- a/scripts/run-email-alerts.sh
+++ b/scripts/run-email-alerts.sh
@@ -5,5 +5,10 @@
 set -a
 [ -f "$HOME/Projects/commercialrealestate/.env" ] && . "$HOME/Projects/commercialrealestate/.env"
 set +a
+# George send path: token from its canonical home (george-gmail/.env), local :9850.
+export GEORGE_URL="${GEORGE_URL:-http://127.0.0.1:9850}"
+if [ -z "$GEORGE_EXTERNAL_SEND_TOKEN" ] && [ -f "$HOME/Projects/george-gmail/.env" ]; then
+  export GEORGE_EXTERNAL_SEND_TOKEN="$(grep -m1 '^GEORGE_EXTERNAL_SEND_TOKEN=' "$HOME/Projects/george-gmail/.env" | cut -d= -f2- | tr -d '"'\''')"
+fi
 cd "$HOME/Projects/commercialrealestate" || exit 1
 /usr/bin/env node scripts/email-alerts.js --send

← d433ef8 col-resize: add click-to-sort headers (asc/desc/reset, numer  ·  back to Commercialrealestate  ·  CRCP email-alerts: George Basic Auth header + don't advance 7d99a28 →