An ongoing adventure

Spamassassin and Sendmail on OpenBSD

This tip shows how to setup Sendmail with Spamassassin on OpenBSD 3.9

First install Spamassassin:

# cd /usr/ports/mail/p5-Mail-SpamAssassin
# make install clean

Next install Procmail:

# cd /usr/ports/mail/procmail
# make install clean

Now configure Sendmail to work with Spamassassin:

# cd /usr/share/sendmail/cf
# cp

Edit with your favorite editor adding/removing the following:

remove: MAILER(local)
add: FEATURE(local_procmail)
add: MAILER(procmail)dnl

Next backup your current sendmail configuration, make and install the new sendmail configuration:

# cp /etc/mail/ /etc/mail/
# cd /usr/share/sendmail/cf
# m4 ../m4/cf.m4 > /etc/mail/

Create the file /etc/procmailrc and add the following to it:

# vi /etc/procmailrc


| spamc

Now add the following line to /etc/rc.local to start spamd at startup

# vi /etc/rc.local

echo -n “spamd”; /usr/local/bin/spamd &

Refer to tip 5 for setting sendmail to send/recieve email

Restart the server

# halt

Finally test your installation of Spamassassin with the following command:

# spamassassin -D < /usr/local/share/doc/SpamAssassin/sample-spam.txt

Some of my personal configuration.
Since I don’t like spam coming to my clients at all, my /etc/procmailrc is as follows:


| spamc

* ˆX-Spam-Status: YES
* ˆX-Spam-Level: ******

This tells procmail to put messages marked as spam with a level higher than 6 to /var/spool/spam which is world writable.

For more information see the Spamassassin Wiki: