When Mail Intake Breaks, CLI Saves the Day

Recovering from Procmail misconfigurations and spool file buildup is simple with Znuny and formail.

In a perfect world, incoming emails flow seamlessly into your Znuny ticketing system and are processed without delay. But in reality, even a small misconfiguration — especially when direct delivery is done via procmail — can quietly derail your mail intake.

Instead of creating tickets, Znuny’s expected mail accumulates messages in the local spool file (e.g., /var/spool/mail/znuny). No alerts. No tickets. Just a growing backlog of unprocessed mail.

🔍 Root Causes for: Misconfigured Procmail

Your local MTA utilizes procmail, in most setups, to pipe incoming mail directly to Znuny's CLI processor:

:0
| /opt/znuny/bin/znuny.Console.pl Maint::PostMaster::Read

If this command fails - due to incorrect paths, permissions, or missing binaries - you won't necessarily see the errors directly, but you'll feel the effects. The default .procmail rc will log the errors, and then it simply drops the mail into the spool file.

MONTHFOLDER=`date +%Y-%m`
YEARFOLDER=`date +%Y`
LOGFILE=$SYS_HOME/var/log/procmail-$MONTHFOLDER.log
VERBOSE=on
COMSAT=no

Common misconfigurations include:

❕This silent fallback behavior is convenient for delivery continuity, and aids you in your recovery.

🛠️ The Fix: formail + Znuny CLI

Once you’ve identified the spool file buildup, you can recover cleanly using formail, a classic tool for splitting mbox-style files into individual messages.

Here’s the full recovery workflow:

mv /var/spool/mail/znuny /var/spool/mail/znuny.orig
formail -s /opt/znuny/bin/znuny.Console.pl Maint::PostMaster::Read < /var/spool/mail/znuny.orig
rm /var/spool/mail/znuny.orig

What this does:

This method ensures every mail is reprocessed through Znuny’s filters, queues, and ACLs—just as if it had arrived live.

🧪 Bonus: Testing Filters in Dev Systems

This same technique is perfect for testing routing logic in non-production environments. You can inject sample mails - optionally downloaded from the productive system - to test custom headers, simulate edge cases, and validate queue assignments - all without touching production.

For example:

It’s a CLI-first workflow that’s reproducible, auditable, and safe.

✅ Key Takeaways

Znuny’s flexibility shines when paired with robust CLI tools and a clear understanding of your mail intake flow. Whether you're recovering from a misfire or proactively testing filters, this method keeps your ticketing system reliable and transparent.


Sign Up For Our Newsletter

Bleiben Sie auf dem Laufenden mit Expertentipps, Updates und Einblicken in das Servicemanagement und Znuny.

Sign up now
and stay up-to-date!

We use rapidmail to send our newsletter. When you subscribe, you consent to the entered data being forwarded to rapidmail. Please also see the GTC and data privacy statement.