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: , , ,

One Response to “Qmail: Move [SPAM] mail to .Junk folder using maildrop”

  1. 1. icen Says:


    running command preline gives me next error:

    preline: usage: preline cmd [ arg … ]

    can you help me how to proper use this command?

Leave a Reply