We are going to use DSPAM in daemon mode using the following command:

sudo /usr/local/bin/dspam --daemon &

If that works we need to reload the postfix configuration to enable our new content filter. You can do that by issuing the following command:

sudo postfix reload

This is of course the manual method of starting DSpam, but you want to be sure it starts after the next scheduled reboot. Because by the time you do that you will have forgotten all about it and no mail will arrive anymore.

To start DSPAM automatically we are going to use the launchd system from Leopard. Create a file called ‘com.diymacserver.dspam.plist‘ in the directory ‘/System/Library/LaunchDaemons/‘. The content of the file should look like:

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple Computer//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
<plist version=”1.0″>

To load and activate the .plist file and to make sure that it is started after a reboot you’ll need to load the plist file by using the command:

sudo launchctl load /System/Library/LaunchDaemons/com.diymacserver.dspam.plist

You can see if it loaded correctly by using the command:

sudo launchctl list

This will show you all the active plist files.

You can see if everything went correctly by trying to start it using:

sudo launchctl start com.diymacserver.dspam

Next step: Training DSPAM with scripts