DSPAM with qmail

After much tinkering with dspam, jonz (from #dspam on irc.freenode.net) suggested a rather unkosher workaround for the dspam + qmail + maildrop combo.

My particular setup consists of maildrop (part of the Courier package), but this will work with just about any setup as the mail is sent over to the local deliverer AFTER it has been processed with dspam.

# addgroup dspam
# adduser [mailuser] dspam
# ./configure --with-dspam-group=dspam --with-dspam-home-group=dspam \
  --enable-spam-delivery --enable-delivery-to-stdout --enable-homedir
# make && make install
# chmod 0755 /usr/local/bin/dspam
# chmod 0644 /usr/local/etc/dspam.conf

Your home .qmail should read:

|dspam --user [username] --deliver=innocent,spam --stdout | maildrop

Your home .mailfilter should read something like:

if (/^X-DSPAM-Result: spam/:h)
{
        to /home/[username]/Spam # Note: mbox format. dspam_corpus is incapable of taking Maildir
}
else
{
        to /home/[username]/Maildir/
}

Note: Using maildrop in a pipe in the .qmail file, it will cause to ignore any dspam error. To solve this your home .qmail should read:

|/usr/bin/preline -f /usr/bin/maildrop

And your home .mailfilter should read something like:

xfilter "dspam --user [username] --deliver=innocent,spam --stdout"
if (/^X-DSPAM-Result: spam/:h)
{
        to /home/[username]/Spam # Note: mbox format. dspam_corpus is incapable of taking Maildir
}
else
{
        to /home/[username]/Maildir/
}

Alternately, if you use Qmail + vpopmail + dspam, try this very simple solution:

In your .qmail-default file for the virtual domain replace the vdelivermail line with this:

| /usr/bin/dspam --mode=teft --deliver=innocent --feature=chained,noise --user $EXT@$USER --stdout | /home/vpopmail/bin/vdelivermail '' boun
ce-no-mailbox

Make sure the vpopmail user has permission to execute dspam.


If you want use dspam without maildrop, you can use safecat, as explained in this page. Your dspam.conf should have these variables set up:

UntrustedDeliveryAgent "/usr/bin/safecat Maildir/tmp Maildir/new"
QuarantineAgent "/usr/bin/safecat Spam/tmp Spam/new"
Broken returnCodes

And your .qmail should read:

|/usr/local/bin/dspam --deliver=innocent

The .qmail-innocent:

|/usr/local/bin/dspam --source=error --class=innocent --deliver=innocent

The .qmail-spam:

|/usr/local/bin/dspam --source=error --class=spam

If you still have questions, try: Getting Help with DSPAM

last edited 2006-01-08 21:15:55 by Trek00