In the following tutorial we are going to cover the procedure of installing and integrating SpamAssassin with Exim on a CentOS 7 Linux VPS. Once the set-up is completed, SpamAssassin will be able to scan and mark the emails detected as SPAM.
What is SpamAssassin?
It is a software program released under the Apache License 2.0 used for e-mail spam filtering based on content-matching rules. It is a very intelligent email filter which uses a diverse range of tests to identify unsolicited bulk email and apply the tests to email headers and content to classify email using advanced statistical methods.
Before proceeding any further, make sure you have a mailserver with Exim setup on your SSD virtual server. You can follow our great article on how to setup a mailserver with Exim and Dovecot on a CentOS 7 VPS if you don’t have Exim setup already on your Linux VPS.
UPDATE THE SYSTEM
ssh
to your server and initiate a screen
session using the command below:
once you’re in a screen
session, update your CentOS 7 VPS using yum
as in:
INSTALL SPAMASSASSIN
SpamAssassin is available in CentOS 7 base
repository, so you can easily install it using yum
:
Once it’s installed, edit /etc/mail/spamassassin/local.cf
using your favorite editor and set the following:
with all that in place, proceed with starting spamassassin up and adding it to your system’s startup using systemctl
update spamassassin rules using:
next, check if spamassassin is listening on localhost (127.0.0.1) on port 783 using ss
from iproute2
:
CONFIGURE EXIM WITH SPAMASSASSIN
OK, next thing to do is to configure Exim to utilize Spamassassin for scanning and tagging unsolicited emails as SPAM. So, make a backup of your current Exim configuration file using:
Next, edit exim.conf
and add the following line in the beginning of the file:
Next, add or uncomment the spamd_address
line as in:
and add the following within the ACLs
section in your Exim configuration file:
Next, create the following Exim system filters in /etc/exim/filters
:
and restart Exim for the changes to take effect using:
TEST SPAMASSASSIN
To test the setup, simply send a test email with subject XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
to any email account available on the mailserver and you should see the following lines in the email header:
LET US DO THIS FOR YOU?
Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install and integrate SpamAssassin with Exim. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.