tutorial

How to Monitor Mailtrain Email Marketing Server 2026

Mailtrain is a self-hosted email newsletter platform built on Node.js. This guide shows you how to monitor your Mailtrain web UI, SMTP queue, campaign delivery workers, and database health with Vigilmon.

Mailtrain is an open-source, self-hosted email list management platform built on Node.js. It handles subscriber lists, campaign scheduling, and SMTP delivery — all on your own infrastructure. That self-hosted control means you own the uptime: if your Mailtrain instance goes down during a campaign send, emails queue silently, subscribers experience delays, and you may not know until campaign reports show a delivery cliff. Vigilmon monitors each layer of your Mailtrain stack so you catch failures before they affect campaigns.

What You'll Set Up

  • HTTP uptime monitoring for the Mailtrain web UI
  • Health endpoint to verify application and database readiness
  • SMTP queue heartbeat to confirm delivery workers are running
  • Database and Redis connectivity checks
  • SSL certificate expiry alerts

Prerequisites

  • Mailtrain v2 or later deployed on a Linux VPS or Docker
  • Node.js, MySQL/MariaDB (or MongoDB for v2), and an SMTP relay configured
  • A free Vigilmon account

Step 1: Monitor the Mailtrain Web Interface

Mailtrain's web UI is the entry point for everything — list management, campaign creation, and reports. If it's down, operators are blind.

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter your Mailtrain URL: https://mail.yourdomain.com.
  4. Set Check interval to 1 minute.
  5. Set Expected HTTP status to 200.
  6. Add a keyword check for "Mailtrain" or your organization name — catches cases where nginx returns 200 but serves an error page.
  7. Click Save.

Step 2: Add a Health Check Endpoint to Mailtrain

Mailtrain doesn't ship with a health endpoint by default. Add one using Mailtrain's plugin system or a custom Express route in a local fork.

If you're running Mailtrain behind nginx and have access to the source, add a lightweight health route:

// In Mailtrain's Express app setup (routes/health.js)
const express = require('express');
const router = express.Router();
const db = require('../lib/db');

router.get('/', async (req, res) => {
  const status = { app: 'ok' };
  try {
    await db.query('SELECT 1');
    status.database = 'ok';
  } catch (e) {
    status.database = e.message;
  }
  const code = Object.values(status).every(v => v === 'ok') ? 200 : 503;
  res.status(code).json(status);
});

module.exports = router;

Register it in the main app file:

app.use('/health', require('./routes/health'));

Then update your Vigilmon monitor to probe https://mail.yourdomain.com/health. A 503 response tells you whether it's the application or the database that's failing.

Alternatively, if you can't modify Mailtrain's source, use a TCP monitor (Step 3) to verify the port is listening.


Step 3: Add a TCP Port Monitor

Even without a health endpoint, a TCP check verifies that Mailtrain's Node.js process is alive and accepting connections.

  1. In Vigilmon, click Add MonitorTCP Port.
  2. Enter your server's IP or hostname.
  3. Enter Mailtrain's port (3000 by default, or 443 if behind nginx with SSL termination).
  4. Set Check interval to 1 minute.
  5. Click Save.

Pair this with the HTTP monitor — if HTTP fails but TCP succeeds, the application is running but returning errors. If both fail, the process has crashed.


Step 4: Monitor SMTP Queue Workers with a Heartbeat

Mailtrain sends emails through SMTP zones configured in the admin panel. When a campaign runs, a sending worker picks up messages and delivers them via your SMTP relay. If the worker crashes mid-campaign, the queue stalls.

Add a heartbeat cron job that pings Vigilmon after each successful queue flush:

  1. In Vigilmon, click Add MonitorCron Heartbeat.
  2. Set the expected ping interval to match your sending frequency (e.g., 10 minutes for a high-volume deployment).
  3. Copy the heartbeat URL.
  4. Set the VIGILMON_HEARTBEAT_URL environment variable on your Mailtrain server.

Add a cron script on your server that verifies the queue depth and pings if it's draining:

#!/bin/bash
# /usr/local/bin/mailtrain-queue-check.sh
QUEUE_SIZE=$(mysql -u mailtrain -p"$DB_PASS" mailtrain -sNe \
  "SELECT COUNT(*) FROM sent_messages WHERE status='queued' AND created < NOW() - INTERVAL 10 MINUTE;")

# If queue is not growing stale, signal Vigilmon
if [ "$QUEUE_SIZE" -lt 1000 ]; then
  curl -s "$VIGILMON_HEARTBEAT_URL"
fi

Schedule it with cron:

*/10 * * * * /usr/local/bin/mailtrain-queue-check.sh

If the sending zone workers crash or the queue stops draining, the heartbeat stops and Vigilmon alerts.


Step 5: Monitor the Database

Mailtrain stores subscribers, lists, campaigns, and send logs in MySQL/MariaDB. A database failure stops all operations.

Use a TCP monitor to verify the database port:

  1. Add a TCP Port monitor for your database server.
  2. Enter the MySQL port (3306).
  3. Set Check interval to 1 minute.

For external database servers (RDS, managed MySQL), add the database host and port. If your database is on the same host as Mailtrain, the application health check in Step 2 already covers this via the SELECT 1 query.


Step 6: SSL Certificate Alerts

Mailtrain is typically served behind nginx with Let's Encrypt certificates. Expired certificates break the web UI and any API integrations that call your Mailtrain instance.

  1. Open the HTTP / HTTPS monitor for your Mailtrain URL.
  2. Enable Monitor SSL certificate.
  3. Set Alert when certificate expires in less than 21 days.

Check your nginx config to confirm which domains are covered:

grep -r "server_name" /etc/nginx/sites-enabled/

Add a separate SSL monitor for each domain served by Mailtrain.


Step 7: Configure Alert Channels

  1. Go to Alert Channels in Vigilmon and add Slack, email, or PagerDuty.
  2. Route queue heartbeat alerts to your operations team — a missed heartbeat during a campaign send needs immediate attention.
  3. Set Consecutive failures before alert to 2 on the UI monitor to avoid false positives from transient nginx reloads.
  4. Add a maintenance window in Vigilmon before planned deployments:
curl -X POST https://vigilmon.online/api/maintenance \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"monitor_id": "your-monitor-id", "duration_minutes": 15}'

Summary

| Monitor | Target | What It Catches | |---|---|---| | Web UI | https://mail.yourdomain.com | UI down, nginx proxy failure | | Health endpoint | /health | Application or database error | | TCP port | :3000 or :443 | Node.js process crash | | SMTP queue heartbeat | Heartbeat URL | Sending worker crash, queue stall | | Database TCP | :3306 | MySQL unreachable | | SSL certificate | Mailtrain domain | Let's Encrypt renewal failure |

Self-hosted Mailtrain gives you full control over your email marketing infrastructure — but also full responsibility for its uptime. Vigilmon covers the web layer, application layer, database, and SMTP queue, ensuring you know about failures within minutes rather than discovering them through a campaign's bounce report.

Monitor your app with Vigilmon

Free plan — 5 monitors, no credit card required. Up and running in 60 seconds.

Start free →