Guide updated on 29th of February 2016

Configure spamassassin

Spamassassin is the antispam system we 'll use

Enable Spamassassin

systemctl enable spamassassin.service

Edit /etc/default/spamassassin to change the options :

OPTIONS="--create-prefs --max-children 5 --helper-home-dir -u vpopmail -v -x -i -m 5 -c -H -s mail --virtual-config-dir=/home/vpopmail/.spamassassin"

IP::Country::Fast perl installation

Install perl package (deb)

dpkg -i /downloads/deb-packages/libip-country-perl_2.28-1_all.deb

Take the latest version of IP database from

cd /usr/share/perl5/IP/Country/Fast
mv cc.gif cc.gif.old
mv ip.gif ip.gif.old
cd /downloads/

Configure pyzor

Add the Pyzor servers by running the following command.

pyzor --homedir /etc/spamassassin discover
chmod 666 /etc/spamassassin/servers

OPTIONAL : If you want to report spam with the Vipul's Razor spam-reporting system

razor-admin -d -home=/etc/razor -create
razor-admin -d -home=/etc/razor -register

Load additionnal plugins

Uncomment this in /etc/spamassassin/init.pre (line 22)

loadplugin Mail::SpamAssassin::Plugin::RelayCountry

Uncomment this in /etc/spamassassin/v310.pre (line 24)

loadplugin Mail::SpamAssassin::Plugin::DCC

Uncomment this in /etc/spamassassin/v320.pre (line 53)

loadplugin Mail::SpamAssassin::Plugin::Rule2XSBody

Enable additionnal features

Edit /etc/spamassassin/ to change the following options :

Uncomment following lines

required_score 5.0
use_bayes 1
bayes_auto_learn 1

Add following lines

score BAYES_99 5.300

add_header all Relay-Country _RELAYCOUNTRY_
skip_rbl_checks 1

use_pyzor 1
pyzor_options --homedir /etc/spamassassin/

use_razor2 1
razor_config /etc/razor/razor-agent.conf

OPTIONAL : If you want to change mail classification based on relaying countries, add following lines in /etc/spamassassin/

header RELAYCOUNTRY_BAD X-Relay-Countries =~ /CN/
describe RELAYCOUNTRY_BAD Relayed through China at some point

header RELAYCOUNTRY_GOOD X-Relay-Countries =~ /^(BE|FR)/
describe RELAYCOUNTRY_GOOD Relayed through Belgium or France

Create a compiled version of some ruleset


Test configuration and start the service

/usr/bin/spamassassin -D --lint

systemctl start spamassassin

OPTIONAL : If you want qmail-smtpd to reject messages where the domain portion of the envelope sender is not a valid domain (feature non-related to spamassassin but added by patch qmail-1.03-mfcheck.3.patch.)

echo 1 > /var/qmail/control/mfcheck

Configure courier

Users comments

Error connecting to Database!

Color Coded Qmail Installation Key
  Regular Black Text     Qmail installation notes and summaries by the author.
  Bold Black Text     Commands to be run by you, the installer.
  Bold/Regular Red Text    Vital and/or critical information.
  Regular Blue text     Denotes helpful tips and hints or hyperlinks.
  Regular Orange Text     Command line output.
  Bold/Regular green text     Denotes the contents of a file or script.