I'm using postfix/mutt/procmail on a Linux/Debian and I've some trouble filtering cron emails with procmail, I just want to move them to the cron/ maildir directory, but no lucky till now. I've several other rules on .procmailrc to move emails with ^From: to a specific directory, only the cron rule doesn't work.


postmaster:    root
root:          alex


* ^From: Cron Daemon <root@hellspawn>
* ^Subject: Cron .*

headers of a mail sent by cron:

Return-Path: <alex@hellspawn>
X-Original-To: alex
Delivered-To: alex@hellspawn
Received: by hellspawn (Postfix, from userid 1000)
    id 27E2E1920C5B; Fri, 31 Jan 2014 16:30:09 +0100 (CET)
From: Cron Daemon <root@hellspawn>
To: alex@hellspawn
Subject: Cron <alex@hellspawn> $HOME/.getmail/getmail2.sh
Content-Type: text/plain; charset=UTF-8
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/alex>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=alex>
Message-Id: <20140131153009.27E2E1920C5B@hellspawn>
Date: Fri, 31 Jan 2014 16:30:09 +0100 (CET)

~/.forward (guess it is useless in this case, just given a try):


What's wrong?

update 12/5/14

I ended up using the negated ! rule below with noop nested block { } and else E, seems like is the "Cron Daemon" part of the address creating the problem.

* ! ^From.*root@hellspawn
* ! ^Subject:.*Cron Daemon
{ }
:0 E
  • Your rules works as intended. The error must somewhere else. – user601 Jan 31 '14 at 20:25
  • 1
    Add VERBOSE=yes and examine the output in procmail.log for error indications. See also partmaps.org/era/mail/procmail-debug.html – tripleee Feb 4 '14 at 7:51
  • Incidentally, the lock file (when saving to a folder) and the trailing .* on the Subject: regex are superfluous if not outright wrong. See also partmaps.org/era/procmail/mini-faq.html – tripleee Feb 4 '14 at 7:52
  • VERBOSE=on revealed that procmail: No match on "^From:.*Cron.*root@hellspawn", used some variant already without success – Alex Feb 5 '14 at 10:46
  • Seems like any match on From isn't working (I guess is something about local users email). The first try on Subject only worked. – Alex Feb 5 '14 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.