In order the use the filter you need to have one of these in your .qmail:

|preline -f maildrop -w 90 /etc/mailfilter
|preline -f maildrop -w 90 /etc/mailfilter TAG
|preline -f maildrop -w 90 /etc/mailfilter SORT
|preline -f maildrop -w 90 /etc/mailfilter DROP

I am hoping that future version of qmailadmin will have
an admin screen that looks like this:

Spam filter setup:
Email_Account   Nothing   Tag_only  Filter  Delete    Configuer
bob                      O            O            X       O  [config]
dave                     O            X            O       O  [config]
dale                      O            O            O       X  [config]

The mailfilter file that could be included in the qmailadmin distro:
--- cut here ---
HOME="$PWD"
DEFAULT="$HOME/Maildir/"
USERNAME=`echo ${PWD##*/}`
SPAMFOLDER=`echo "$HOME/Maildir/${2:-.spam}"`

# Make sure the quota file is in place.
# Vpopmail does not create it by default.
# Vpopmail also removes it when you change the quota.
`test -s "$HOME/Maildir/maildirsize"`
if ( $RETURNCODE == 1 )
{
   `~vpopmail/bin/vuserinfo -Q [EMAIL PROTECTED]
   `chown vpopmail:vchkpw $HOME/Maildir/maildirsize`
   `chmod 640 $HOME/Maildir/maildirsize`
}

# Don't scan the mail if it was not asked for.
if ( $1 =~ /TAG/ || $1 =~ /SORT/ || $1 =~ /DROP/ )
{
   if ( $SIZE < 262144 )
   {
      exception {
         xfilter "/usr/bin/spamc -f -u [EMAIL PROTECTED]"
      }
      if ( i$1 =~ /SORT/ || $1 =~ /DROP/ )
      {
         if (/^X-Spam-Flag: *YES/)
         {
            if ( $1 =~ /SORT/ )
            {
               `test -d "$SPAMFOLDER"`
               if ( $RETURNCODE == 1 )
               {
                  `~qmailq/bin/maildirmake "$SPAMFOLDER"`
               }
               to "$SPAMFOLDER/"
               exit
            }
            if ( $1 =~ /DROP/ )
            {
               exit
            }
         }
      }
   }
}

# Perhaps qmailadmin will have a server side filter screen one day.
exception {
   include $HOME/.mailfilter
}
--- cut here ---

* Parts of this mailfilter is based on Jeff Hedlund's posting.

I hope something like this makes it into future version of qmailadmin.
G�rald


Reply via email to