More recent versions of qmail-scanner include native support for both spamc
and spamassassin.  However, since qmail-scanner is itself a Perl script, it
can use significant resources while running.  If you don't need the
antivirus features of qmail-scanner, you can use qmail-spamc instead.  This
small wrapper program (written in c) can be used to insert spamc into the
stream ahead of qmail-queue.  It is used in much the same fashion as
qmail-scanner, which requires patching qmail to use the QMAILQUEUE
environment variable.

From a system startup file (like /etc/profile), set QMAILQUEUE like this:

	export QMAILQUEUE='/usr/bin/qmail-spamc'

and add a similar line to the run script for the smtpd service.  If you are
using the recommended daemontools installation, you can do something like
this instead:

	echo /usr/bin/qmail-spamc > /service/smtpd/env/QMAILQUEUE

Now, all e-mail sent through qmail (either by smtp or qmail-inject) will be
processed by spamc/spamd before being scheduled for delivery.  You will
have to have both qmail-queue and spamc in a directory in the system PATH
in order for this to work correctly.

You can set several command line options supported by spamc via environment
variables. These options are supported (see 'man spamc' for their meaning):

   spamc option    | env. variable
  -----------------+---------------------------
   -U <socketpath> | SPAMDSOCK  = <socketpath>
   -d <hostname>   | SPAMDHOST  = <hostname>
   -p <port>       | SPAMDPORT  = <port>
   -S              | SPAMDSSL   = 1
   -s <size>       | SPAMDLIMIT = <size>
   -u <username>   | SPAMDUSER  = <username>

Example: In order to use the Unix domain sockets feature of spamc/spamd, you
need to set an additional enviroment variable (in a top level script):

	export SPAMDSOCK='/path/to/spamd.sock'

and if you are using the daemontools run files for qmail, also:

	echo /path/to/spamd.sock > /service/smtpd/env/SPAMDSOCK

and now all SMTP e-mail will be scanned by spamc/spamd

John Peacock
jpeacock (at) rowman (dot) com
(revised Sep. 08 2003)


To build qmail-spamc, type

	test -e Makefile || perl Makefile.PL < /dev/null
	make spamc/qmail-spamc

at the top level. (Nov 20 2002 jm)

