Setting up DSPAM

Please note that this information is no longer up to date. The content of this site has moved to a new domain which is kept up to date. Apologies for the inconvienince.

Here is my first instalment of how to install DSPAM on OS X and using the installation of Postfix, Courier IMAP and MySQL described earlier as a basis.

Please note that these instructions are not yet full-proof and tested by others than myself. Please don not try to do this yourself if your not very comfortable using the Terminal, wading through log-files and solving complex issues.

I’ve chosen to incorporate DSPAM as a content filter for Postfix. This means that email comes into Postfix, passes through DSPAM and gets reinserted into Postfix for delivery into the users mailbox. (In the near future I’m looking at solutions like maildrop for delivery into the maildir.)

DSPAM is a very good spamfilter and is easy to use and train by it’s users. Training can be made very simple, I’ve chosen to use a folder structure in which people can drop their missed spam (false negative) into the Junk folder which gets processed overnight to train DSPAM. It’s also possible to use forwarding the spam email to a local address to train DSPAM.

My Todo list for the DSPAM setup, in no particular order:

  • Using maildrop for delivery and by doing this, deliver SPAM into a quarantine folder at the users mailbox.
  • Learn more about the setup of users and groups in DSPAM to be able use each others training data

Note: If you have problems getting it to work please post your errors or problems on the forum. This is a better way to capture the knowledge spread and makes it accessible to others. Other remarks and opinions can be added to this page as comments.

10 Responses to “Setting up DSPAM”

  1. Dave Says:

    In addition to dspam i’d like to introduce you to a anti-spam technology called greylisting. there is also a postfix tool called postgrey. i already found a postgrey on osx tutorial. maybe thats interesting for you, too:

  2. Richard5 Says:

    Thanks Dave, greylisting is on my to-do list and it will be documented as soon as the DSpam stuff is finished.

  3. Dave Says:

    Hi Richard5, i found a more detailed tutorial on installing postgrey. the website itself is in francais and i have no clue on howto read that ;-) but the important parts are in english.

    just scroll down to “Utilisation des “listes grises” which probably means greylisting :-) they also describe other antispam techniques (and howto install on osx) there.

  4. Richard5 Says:

    Thanks for mentioning, I haven’t delved into this matter but a quick scan turns up: which also looks very nice. Has a web interface for admin purposes as well.

    By the way, you can use babelfish or google to translate !

  5. Dave Says:

    i just finished setting up postgrey with a combination of both tutorials i mentioned earlier. so far it works fine, but i cant wait to read your next tutorial concerning dspam/greylisting :-)

    i’ll probably dump my solution and adopt yours ;)

    yesterday i thought about: why not cooking a nice sh script to do everything mentioned in your tutorial. when i have some spare time i’ll probably think about such an “a few clicks an go” installer. as a replacement for postfixadmin the syscp admin would be really cool as you could administrate virtual web hosting with it, too.

  6. Stephen Says:

    Ho Richard

    DSPam was starting up with an error indicating that it couldnt read through the /tmp/mysql.sock file.

    I fixed it by modifying the startupparemters.plist file for (DSPam to have it depend on MYSQL basicall causing it to wait until MySql is loaded)

  7. Richard5 Says:


    If you look at the starting DSpam page you’ll see that the info you mention is there.

  8. Jan Says:


    Have a look at

  9. Lance Says:

    Why bother with DSPAM when you can use ASSP?

    I’m using these instructions but using ASSP instead. Since it is a filtering proxy, it greatly simplifies the postfix config and eliminates maildrop from the equation.

    Since I finished training the bayesian filter (6 days), I haven’t had one single spam come through.

  10. Richard5 Says:

    Lance, there are much more solutions to solving the spam problem, I’ve chosen for DSpam because it integrates nicely with my setup and does everything I need which is stopping most, if not all, of the spam messages.

    I’ve had a quick look at ASSP and it looks interesting but there is a small problem why it won’t work in our setup. It does not allow incoming SSL/TLS connections which you would really like to have because you don’t want your authentication details going over the internet as readable text. Sure you could use stunnel but that will interfere with all the other stuff as documented in the FAQ.

    All the extra stuff ASSP does can be done in Postfix, I’m still working on that part, like greylisting to decrease the amount of spam send to Dspam.