====== Qmail and Procmail How To ======
==== qmail wrapper to check each mail ====
#!/bin/sh
# original modified, taken from http://openwall.info/wiki/internal/email/qmail-procmail
/var/qmail/bin/preline /usr/local/bin/procmail /usr/local/etc/procmail.rc && exit 0
# check if procmail returned EX_TEMPFAIL (75)
[ $? -eq 75 ] && exit 111
# do we want to discard the message?
[ $? -eq 99 ] && exit 99
# otherwise return a permanent error
exit 100
==== Define procmail rules ====
This will send all messages with "//^X-Spam-Status: Yes//" and send those messages to \\
spammer@test.com email's inbox.
SHELL=/bin/sh
#LOGFILE=/tmp/procmail.log
#VERBOSE=yes
EXITCODE=99
:0h
*^X-Spam-Status: Yes
/usr/local/vpopmail/domains/test.com/spammer/Maildir/new
# deliver the message normally
EXITCODE=0
#
# this line needs to be here
# or else all mail will get double delivered to Maildir
# and to /var/mail/vpopmail, slowly filling /var
:0
/dev/null
==== Now run script using .qmail / .qmail-default ====
| /usr/local/bin/qproc-wrap.sh
| /usr/local/vpopmail/bin/vdelivermail '' bounce-no-mailbox