tutorial

Monitoring Snappymail Webmail with Vigilmon

Snappymail is a fast, lightweight self-hosted webmail — but its filesystem-based storage and PHP backend can fail silently. Here's how to monitor Snappymail's login UI, admin panel, API endpoint, and IMAP connectivity with Vigilmon.

Snappymail (the actively maintained fork of RainLoop) is the go-to lightweight webmail for self-hosters who want speed and simplicity over Roundcube's feature breadth. It requires no database by default — session and account data lives on the filesystem — which makes it easy to deploy but also means a permissions problem or a full disk can break it silently. Its PHP backend serves the full webmail SPA, admin panel, and a JSON-RPC API all from a single entry point. Vigilmon lets you monitor all three layers — the user-facing login page, the admin panel, and the API handler — plus IMAP connectivity, so you catch failures before your users do.

What You'll Set Up

  • HTTP uptime monitor for the Snappymail login page (user-facing SPA availability)
  • Keyword monitor for the admin panel at /?admin (admin backend health)
  • API endpoint monitor at /?/api/ (PHP backend processing health)
  • SSL certificate expiry alerts for the webmail domain
  • Heartbeat monitor for end-to-end IMAP connectivity via a periodic login API check

Prerequisites

  • Snappymail installed and accessible over HTTP or HTTPS
  • An IMAP/SMTP mail server backend that Snappymail is configured to connect to
  • A free Vigilmon account

Step 1: Monitor the Snappymail Login Page

The Snappymail root URL (/) returns the full single-page application shell. A successful response with the keyword SnappyMail in the HTML confirms that PHP is running, the index.php entry point is accessible, and the SPA assets are being served correctly.

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter your Snappymail URL — e.g. https://mail.yourdomain.com.
  4. Set Check interval to 1 minute.
  5. Set Expected HTTP status to 200.
  6. Expand the Keyword section and enter SnappyMail.
  7. Click Save.

The SnappyMail keyword appears in the page title and meta tags of the SPA shell. If PHP is returning an error, a blank page, or a misconfigured response, this keyword will be missing and Vigilmon will alert.


Step 2: Monitor the Snappymail Admin Panel

The Snappymail admin panel at /?admin is a separate interface for managing server configurations, domains, and plugins. Monitoring it independently confirms that the admin backend routing is working — a separate concern from the user-facing SPA. Snappymail sometimes upgrades the admin panel independently of the user interface.

  1. Click Add Monitor in Vigilmon.
  2. Set Type to HTTP / HTTPS.
  3. Enter https://mail.yourdomain.com/?admin.
  4. Set Check interval to 5 minutes (admin panel changes less frequently).
  5. Set Expected HTTP status to 200.
  6. Expand Keyword and enter SnappyMail Admin Panel.
  7. Click Save.

The admin panel login page includes "SnappyMail Admin Panel" in its content. This monitor catches configuration errors specific to the admin backend — for example, if the admin password file is missing or the admin session directory is unwritable, Snappymail may serve an error for /?admin while the user-facing /? still loads.


Step 3: Monitor the Snappymail API Endpoint

Snappymail handles all authenticated webmail actions (fetching mail, sending, flagging) through a single JSON-RPC-style API at /?/api/. Even without valid credentials, a POST to this endpoint returns a JSON error response — which confirms that the PHP backend is processing requests end-to-end. This is a deeper health signal than the static SPA shell in Step 1.

  1. Click Add Monitor in Vigilmon.
  2. Set Type to HTTP / HTTPS.
  3. Enter https://mail.yourdomain.com/?/api/.
  4. Set Method to POST.
  5. Set Request body to {} (empty JSON object).
  6. Set Check interval to 1 minute.
  7. Set Expected HTTP status to 200.
  8. Expand Keyword and enter error (the JSON error key returned on unauthenticated requests).
  9. Click Save.

An unauthenticated POST to /?/api/ returns a JSON response like {"Result":false,"Error":"NotLogged"}. The presence of any JSON response confirms the API handler is alive. If the PHP backend crashes or the API routing breaks, this request will return a 500 error or a blank response and Vigilmon will alert.


Step 4: SSL Certificate Alerts

Snappymail is designed for HTTPS deployment — it sets the secure flag on session cookies and its security defaults assume TLS. An expired certificate causes immediate browser errors that prevent any user from accessing the webmail interface.

  1. Open the Snappymail login page monitor from Step 1.
  2. Scroll to the SSL Certificate section.
  3. Enable Monitor SSL certificate expiry.
  4. Set Alert threshold to 21 days before expiry.
  5. Click Save.

For Let's Encrypt deployments, verify the renewal timer is active:

# systemd timer (most modern distros)
systemctl status certbot.timer

# Or check the renewal hook
cat /etc/letsencrypt/renewal/mail.yourdomain.com.conf

A 21-day alert window gives you time to diagnose and fix failed auto-renewals before your users see a certificate error.


Step 5: Heartbeat Monitoring for IMAP Connectivity

Snappymail establishes a fresh IMAP connection for each login. If your IMAP server (Dovecot, Courier, etc.) goes down, Snappymail's login page still loads correctly — it just fails when the user submits credentials. A heartbeat monitor catches this by performing a real login check periodically.

  1. In Vigilmon, click Add MonitorCron Heartbeat.
  2. Set the expected ping interval to 5 minutes.
  3. Copy the heartbeat URL (e.g. https://vigilmon.online/heartbeat/abc123).

Create a server-side script that posts a login request to the Snappymail API and pings the heartbeat on success:

#!/bin/bash
# /usr/local/bin/snappymail-health-check.sh

SNAPPYMAIL_URL="https://mail.yourdomain.com"
TEST_USER="monitor@yourdomain.com"
TEST_PASS="your-test-password"
HEARTBEAT_URL="https://vigilmon.online/heartbeat/abc123"

# Post a DoLogin action to the Snappymail API
RESPONSE=$(curl -s -X POST \
  -H "Content-Type: application/json" \
  "$SNAPPYMAIL_URL/?/api/" \
  -d "{
    \"Action\": \"DoLogin\",
    \"Login\": \"$TEST_USER\",
    \"Password\": \"$TEST_PASS\",
    \"Language\": \"\",
    \"AdditionalCode\": \"\"
  }")

# Check for a successful login (Result: true or non-null token)
if echo "$RESPONSE" | grep -q '"Result":true'; then
  curl -s "$HEARTBEAT_URL" > /dev/null
  echo "Login successful — heartbeat sent"
else
  echo "Login failed: $RESPONSE"
  exit 1
fi

Create a dedicated monitoring mailbox with a known password. Schedule the check with cron:

*/5 * * * * /usr/local/bin/snappymail-health-check.sh >> /var/log/snappymail-health.log 2>&1

If the IMAP server goes down, the DoLogin call will fail with an IMAP connection error, the heartbeat will not be sent, and Vigilmon will alert after 5 minutes — catching the full Snappymail → IMAP chain.


Step 6: Configure Alert Channels

  1. Go to Alert Channels in Vigilmon and add email, Slack, or a webhook.
  2. Set Consecutive failures before alert to 2 on the login page monitor — brief PHP-FPM restarts during server maintenance can cause a single probe miss.
  3. Keep the heartbeat alert at 1 missed ping since any missed heartbeat already means at least 5 minutes of IMAP login failures.

Summary

| Monitor | Target | What It Catches | |---|---|---| | HTTP + keyword (SnappyMail) | https://mail.yourdomain.com | PHP crash, nginx/Apache down | | HTTP + keyword (admin panel) | /?admin | Admin backend routing failure | | HTTP POST to API | /?/api/ | PHP backend processing failure | | SSL certificate | Webmail domain | Let's Encrypt renewal failure | | Cron heartbeat | Heartbeat URL every 5 min | IMAP server down, login chain failure |

Snappymail's lightweight design means fewer moving parts — but it also means fewer built-in health checks. Vigilmon fills that gap with external uptime monitoring across the login UI, admin panel, API handler, and IMAP backend connectivity.

Monitor your app with Vigilmon

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

Start free →