Amavisd + SpamAssassin not working? No mail header X-Spam.

If you want Amavisd to insert X-Spam-* headers in each email, please decrease Amavisd setting $sa_tag_level_deflt (in Amavisd config file )to a very low score, e.g. -999, then restart Amavisd service:

$sa_tag_level_deflt  = -999;

That means Amavisd will insert X-Spam-Flag and other X-Spam-* headers when email score >= -999.

Do not forget to restart services Amavisd.


Config Centos 6 with Postfix, Amavis-new, ClamAV And Spamassassin

Setup for Centos 6.

Step 1:  Install and activate Epel-release

yum install epel-release
vim /etc/yum.repos.d/epel.repo

and change this

name=Extra Packages for Enterprise Linux 6 – $basearch

like this

name=Extra Packages for Enterprise Linux 6 – $basearch

Step 2: Install amavisd-new, clamav and spamassassin:

yum install amavisd-new clamav clamav-devel clamd spamassassin

Verify amavis and clam user’s:

[root@server ~]# cat /etc/passwd | grep “amavis\|clamav”
clam:x:495:491:Clam Anti Virus Checker:/var/lib/clamav:/sbin/nologin
amavis:x:494:490:User for amavisd-new:/var/spool/amavisd:/sbin/nologin

Manually add clam to the amavis group:

[root@server ~]# gpasswd -a clam amavis
Adding user clam to group amavis

and now results
[root@server ~]# groups clam
clam : clam amavis

Finally, new services should have been added to the system:

[root@server ~]# chkconfig –list | grep “amavisd\|clamd\|spamassassin”
amavisd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
clamd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
clamd.amavisd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
spamassassin 0:off 1:off 2:on 3:on 4:on 5:on 6:off

[root@server ~]# chkconfig amavisd on
[root@server ~]# chkconfig clamd on
[root@server ~]# chkconfig clamd.amavisd on

Step 3: Setup Services

vim /etc/clamd.conf

# Comment out the TCPSocket setting:
# TCPSocket 3310             <—–  (Disable this line)

Run comand freshclam

vim /etc/amavisd/amavisd.conf

edit line 20 with your domain
$mydomain = ‘’; # a convenient default for other settings

edit line 152 with your fully-qualified domain name
$myhostname = ‘’; # must be a fully-qualified domain name!

service amavisd start
service clamd start
service clamd.amavisd start
service spamassassin start

Step 4: Integrate Amavis-new with Postfix.

Amavisd will pass all incoming mail to our antivirus and antispam and verify that we are receiving a clean mail, but at this moment we have postfix and amavisd isolated, we need make a small integration.

vim /etc/postfix/

append these lines at the end


edit next file

vim /etc/postfix/

append these lines at the end

smtp-amavis unix -      -       n       -            smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes inet n  -       n      -        -       smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=
-o strict_rfc821_envelopes=yes
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000

In line smtp-avavis unix – – n – <number> smtp
try that number value be the same that amavisd children

[root@server ~]# grep max_servers /etc/amavisd/amavisd.conf
$max_servers = 2; # num of pre-forked children (2..30 is common), -m