Date: Tue, 13 Apr 2004 12:17:15 +0200
From: Arnoud Post
Subject: Webmail server how to

Michael,

I've use your How-to several times now, building a mailserver on
OpenBSD. With some googling around I got it all to work. Thanks for the
help!

You might wan't to add a small config to filter the spam marked by
Spamassassin, I'v put some comment within the scripts for different
options. I personally like to filter directly to the Trash folder
because of the huge amount of spam.
You also might need to change the location of spamc in the script.

Grtz,
Arnoud Post
The Netherlands


Here it is:

cd /home/vpopmail/domains/example.com

Backup the old .qmail-default file:

cp -p .qmail-default .qmail-default.org

Make a new one:

echo "| maildrop mailfilter" > .qmail-default

Make the mailfilter:

vi /home/vpopmail/domains/example.com
VPOP="| /home/vpopmail/bin/vdelivermail '' 
/home/vpopmail/domains/example.com/postmaster"
VHOME=`/var/qmail/vpopmail/bin/vuserinfo -d $EXT@$HOST`
 
if ( $SIZE < 262144 )
{
        exception {
                xfilter "/usr/bin/spamc -f -u $EXT@$HOST"
        }
}
 
if (/^X-Spam-Flag: *YES/)
{
        # try filtering it using user-defined rules
        exception {
                include $VHOME/Maildir/.mailfilter
        }
        # then try delivering it to the Trash folder
        exception {
                # to "$VPOP"
                to "$VHOME/Maildir/.Trash/"
        }
        # or uncomment the following to send it to the .spam folder
        # exception {
        #        # to "$VPOP"
        #         to "$VHOME/Maildir/.spam/"
        # }

        # if not go on with delivery
        exception {
                to "$VPOP"
        }
}
else
{
        exception {
                include $VHOME/Maildir/.mailfilter
        }
        exception {
                to "$VPOP"
        }
}

And another that helped me with a permission error:

chown vpopmail:vchkpw mailfilter .qmail-default; chmod 600  mailfilter

;-)


----- Original Message -----
From: "Michael Bowe"
To: "Arnoud Post"
Sent: Thursday, April 15, 2004 11:20 AM
Subject: Re: Webmail server how to

> Hi Arnoud
>
> Thanks for that info you sent me :-)
>
> I havent included such documentation in my guide in the past, because many
> people use POP3 to collect their mail, and if you start filtering mail into
> folders then it opens a bit of a "can of worms", because POP3 cant see this
> mail. You then need to configure additional scripts to dump old mail from
> IMAP trash folders etc
>
> Perhaps I will put your info into a small hyperlinked doc though, so that
> sites not using POP3 can make use of this functionality
>
> Michael.