Setup postfix with clamav and spamassassin WITHOUT amavis

August 3, 2008


I’ve battled with amavis too often and I started to dislike it a little. So when I wanted to configured my postfix setup to scan for viruses and spam and needed a solution which would work without amavis.

This is what I came up with.

debian administration was kind enough to do the hard work, but this is only the setup for clamav and I also want to spam scan.


First install the packages you will need

apt-get install spamassassin spamc clamav clamsmtp


This is where I followed the ‘Debian administration’ article, in /etc/clamsmtpd.conf you must have

OutAddress: 10026

You could also change:

# A header to add to all scanned email
Header: X-AV-Checked: ClamAV using ClamSMTP (

to add your own header to see if the scanning is working.

For postfix you must have a few lines in /etc/postfix/ that read

# virus scanning
content_filter = scan:
receive_override_options = no_address_mappings

This is only for virus scanning, for spam scanning you will need to tweak /etc/postfix/ also

# interface to spamassassin. 
spamassassin unix - n   n   -   -   pipe
    user=nobody argv=/usr/bin/spamc -f -e
    /usr/sbin/sendmail -oi -f ${sender} ${recipient}

This will feed the mail directly to spamc.

test it

/etc/init.d/clamsmtp restart
/etc/init.d/spamassassin restart
/etc/init.d/postfix restart

That’s it!