Mar 10

I have qmailtoaster installation so my users are in:


you need two create two file:

first called “mailfilter” can be put wherever you want (this file will be in .qmail file), me  I choose:


so now I have:


second called “.qmail” must be pun in user folder in the same dir with Maildir folder, like this:


File contents are:


|preline /usr/bin/maildrop /home/vpopmail/domains/mailfilter


import EXT
import HOST
logfile “/var/log/maildrop/mailfilter.log”
USERHOME=`/home/vpopmail/bin/vuserinfo -d $EXT@$HOST`
if (/^Subject:.*\[SPAM\]/:h)
log “WE got a SPAM, moving mail to spam directory $USERHOME/Maildir/.Junk”
DUMMY=`test -d $USERHOME/Maildir/.Junk`
#if .Junk folder exists
if ( $RETURNCODE == 0 )
to “$USERHOME/Maildir/.Junk”
log “No Junk directory in $USERHOME/Maildir”
to “$USERHOME/Maildir/”
to “$USERHOME/Maildir/”

This works for users in witch dirs you put .qmail file. If you want for whole domain you must use :

/home/vpopmail/domains/MYDOMAIN.XXX/.qmail-default file instead of .qmail in user directory.

written by MG \\ tags: , , ,