Add study user re-engagement reminder emails; v1.1.19

Sends 7/14/30-day inactivity emails to study users who haven't logged in,
with one-click HMAC-signed unsubscribe and automatic re-arm on next login.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nmemmert
2026-07-28 15:56:09 -04:00
parent d0c949070f
commit 2732730f5e
6 changed files with 166 additions and 4 deletions
+10 -1
View File
@@ -29,13 +29,14 @@ import {
refreshContentCaches,
queueHitStatsWrite,
} from './server/data.js'
import { logResendEmailAlignmentWarnings, sendStudyReminderEmail } from './server/email.js'
import { logResendEmailAlignmentWarnings, sendStudyReminderEmail, sendStudyReengagementEmail } from './server/email.js'
import {
detectBot,
sanitizeUserAgent,
shouldCountHit,
recordHit,
scheduleStudyReminders,
scheduleReengagementEmails,
} from './server/study-helpers.js'
import { recordVisitor } from './server/routes/analytics.js'
@@ -179,6 +180,14 @@ Promise.all([
}, 60 * 60 * 1000)
void scheduleStudyReminders(sendStudyReminderEmail)
// Send re-engagement emails to inactive study users every hour
setInterval(() => {
scheduleReengagementEmails(sendStudyReengagementEmail).catch(err => {
console.error('[study-reengagement] failed to schedule emails:', err)
})
}, 60 * 60 * 1000)
void scheduleReengagementEmails(sendStudyReengagementEmail)
app.listen(PORT, () => {
logResendEmailAlignmentWarnings()
console.log(`Portfolio app listening on http://localhost:${PORT}`)