Procmail should be easy to install via your package manager.
Then instead of |/var/qmail/bin/checksubj.sh, you would use: | /usr/bin/procmail -m /home/vpopmail/domains/mydomain.com/username/.procmailrc
(You can also set a global procmailrc for this, and have custom procmailrc's for specific accounts.)
Here is my procmailrc. This is a very small subset of procmail's capabilities, and procmail wizards will no doubt be able to show you much more effective ways to do things, but this works.
Lastly, do you run SpamAssassin on this machine? Take a look at qmailrocks.org, which is a bit outdated, but will give you a step by step way to integrate SpamAssassin into your system.
You could always build a mail server in a VM to test before trying this in your production system of course.
You could use something like:
:0:
* ^FROM: *@mydomain.com
$MAILDIR/new
followed by your processing rules. That should allow anything from your domain to pass through, then filter if it doesn't meet that condition.
# .procmailrc
PATH=/usr/bin:/usr/local/bin
MAILDIR=/home/vpopmail/domains/mydomain.com/myusername/Maildir
LOGFILE=/home/vpopmail/domains/mydomain.com/myusername/procmail.logfile
VERBOSE=off
## move cvs commit messages to /dev/null
:0:
* ^Subject:.MYDOMAIN-CVS-COMMIT*
/dev/null
## delete svn commit messages:
:0:
* ^Subject:.SVN-COMMIT*
/dev/null
# delete messages from cruisecontrol
:0:
* ^FROM:
cruisecontrol@mydomain.com
/dev/null
:0:
* ^Subject:.mydomainportal Build Failed*
/dev/null
:0:
* ^Subject:.*replica*
/dev/null
:0:
* ^Subject:.*SansCash*
/dev/null
# this person wouldn't remove me from her company mailing list,
# so now I just delete everything that comes in:
:0:
* ^FROM:
caitlin@compuzonic.com
/dev/null
# this solves backscatter:
:0:
*^Subject:failure notice*
/dev/null
# this recipe moves all spam that needs to be learned
# by spamassassin back into the spam monitoring folder
#
:0
* ^Subject:.*SPAM
{
foldername=SPAM
:0c
.$foldername/ # stores in .$foldername/new/
:0
* LASTFOLDER ?? /\/[^/]+$
{ tail=$MATCH }
TRAP="mv $LASTFOLDER .$foldername/cur/$tail:2,S"
HOST
}
:0:
*
#lastly, place all remaining email in my new mail folder:
$MAILDIR/new