Replace Resend references with Mailcow SMTP config
- 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 <noreply@anthropic.com>
This commit is contained in:
parent
620bc229ed
commit
70349c2443
10
.env.example
10
.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 <noreply@jeffemmett.com>
|
||||
|
||||
# ============================================
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 <noreply@jeffemmett.com>
|
||||
- ADMIN_API_KEY=${ADMIN_API_KEY}
|
||||
- ADMIN_EMAILS=${ADMIN_EMAILS:-jeff@jeffemmett.com}
|
||||
|
|
|
|||
Loading…
Reference in New Issue