From 70349c2443d1cd51db30e6cdde1c7c8204052a51 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Sun, 15 Feb 2026 16:13:09 -0700 Subject: [PATCH] Replace Resend references with Mailcow SMTP config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - docker-compose: RESEND_API_KEY → SMTP_* env vars - .env.example: Resend section → SMTP section - application.js + waitlist-db.js: rename resend_id → message_id - schema.sql: rename resend_id column → message_id App already used nodemailer/SMTP — this just cleans up legacy naming. Co-Authored-By: Claude Opus 4.6 --- .env.example | 10 ++++++---- api/application.js | 6 +++--- api/waitlist-db.js | 6 +++--- db/schema.sql | 2 +- docker-compose.yml | 5 ++++- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.env.example b/.env.example index 56747a1..cb06d30 100644 --- a/.env.example +++ b/.env.example @@ -9,12 +9,14 @@ DATABASE_URL=postgresql://votc:votc_password@localhost:5432/votc # ============================================ -# Resend API for emails +# SMTP Email (Mailcow) # ============================================ -# Get from: https://resend.com/api-keys -RESEND_API_KEY=re_xxxxxxxxxxxxx +SMTP_HOST=mx.jeffemmett.com +SMTP_PORT=587 +SMTP_USER=noreply@jeffemmett.com +SMTP_PASS=changeme -# Email sender address (must be verified in Resend) +# Email sender address EMAIL_FROM=Valley of the Commons # ============================================ diff --git a/api/application.js b/api/application.js index aaf4f68..f2e3f61 100644 --- a/api/application.js +++ b/api/application.js @@ -110,12 +110,12 @@ const adminNotificationEmail = (application) => ({ ` }); -async function logEmail(recipientEmail, recipientName, emailType, subject, resendId, metadata = {}) { +async function logEmail(recipientEmail, recipientName, emailType, subject, messageId, metadata = {}) { try { await pool.query( - `INSERT INTO email_log (recipient_email, recipient_name, email_type, subject, resend_id, metadata) + `INSERT INTO email_log (recipient_email, recipient_name, email_type, subject, message_id, metadata) VALUES ($1, $2, $3, $4, $5, $6)`, - [recipientEmail, recipientName, emailType, subject, resendId, JSON.stringify(metadata)] + [recipientEmail, recipientName, emailType, subject, messageId, JSON.stringify(metadata)] ); } catch (error) { console.error('Failed to log email:', error); diff --git a/api/waitlist-db.js b/api/waitlist-db.js index fbfa008..fea033a 100644 --- a/api/waitlist-db.js +++ b/api/waitlist-db.js @@ -65,12 +65,12 @@ const welcomeEmail = (signup) => ({ ` }); -async function logEmail(recipientEmail, recipientName, emailType, subject, resendId, metadata = {}) { +async function logEmail(recipientEmail, recipientName, emailType, subject, messageId, metadata = {}) { try { await pool.query( - `INSERT INTO email_log (recipient_email, recipient_name, email_type, subject, resend_id, metadata) + `INSERT INTO email_log (recipient_email, recipient_name, email_type, subject, message_id, metadata) VALUES ($1, $2, $3, $4, $5, $6)`, - [recipientEmail, recipientName, emailType, subject, resendId, JSON.stringify(metadata)] + [recipientEmail, recipientName, emailType, subject, messageId, JSON.stringify(metadata)] ); } catch (error) { console.error('Failed to log email:', error); diff --git a/db/schema.sql b/db/schema.sql index 407de27..d9d4d3b 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -106,7 +106,7 @@ CREATE TABLE IF NOT EXISTS email_log ( recipient_name VARCHAR(255), email_type VARCHAR(100) NOT NULL, -- application_confirmation, waitlist_welcome, status_update, etc subject VARCHAR(500), - resend_id VARCHAR(255), -- Resend API message ID + message_id VARCHAR(255), -- SMTP message ID status VARCHAR(50) DEFAULT 'sent', -- sent, delivered, bounced, failed sent_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, metadata JSONB diff --git a/docker-compose.yml b/docker-compose.yml index 8f5d4b0..74084ed 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,10 @@ services: restart: unless-stopped environment: - DATABASE_URL=postgresql://votc:votc_password@votc-db:5432/votc - - RESEND_API_KEY=${RESEND_API_KEY} + - SMTP_HOST=${SMTP_HOST} + - SMTP_PORT=${SMTP_PORT} + - SMTP_USER=${SMTP_USER} + - SMTP_PASS=${SMTP_PASS} - EMAIL_FROM=Valley of the Commons - ADMIN_API_KEY=${ADMIN_API_KEY} - ADMIN_EMAILS=${ADMIN_EMAILS:-jeff@jeffemmett.com}