Email Spam is known as Junk email, UBE (Unsolicited Bulk Email). If anyone send a identical mail to numerous recipient is simply called Spamming. Spamming is a great problem for all kinds of users, it kill system resource, time and money.
SpamAssassin is a open source free application to provide filtering for unwanted junk email (SPAM). Main theme is that, “filter your mail before it reach your inbox”. You can integrate SpamAssassin with mail server to filter spam email. It providse many useful features like DNS base spam detection, online database, external programs, blacklist etc. In this article we will show you, how you can use smamassassin to fight with email spam, various types of filtering methods, making database to prevent spam etc. so keep eyes on whole article.
Install SpamAssassin on your machine (Single User)
1. Download files from here and extract this
tar -xvzf Mail-spamassassin-*
Now go to Mail-spamassassin-* directory with this command
2. Now install Spamassassin with below command
perl Makefile.PL PREFIX=$HOME make make install
Alternatively you can install spamassassin automatically with apt-get, yum, emerge command. like apt-get install spamassassin.
3. Install Spamassassin Rule set and update this rule set
This command will install and update rules directly from internet.
4. Procmail configuration
Now download and install procmail from here
On your home directory create a new .forward file and edit
cd $HOME touch .forward vim .forward
Now add this line to this file and save the file
|IFS=' ' && exec /usr/bin/procmail -f- || exit 75 #user
Now create a new file .procmailrc and edit it with vim and add those lines
:0fw: spamassassin.lock | /home/user/bin/spamassassin :0: * ^X-Spam-Status: Yes caughtspam
caughtspam is located in home directory, if a mail is spammed the it will go to caughtspam directory.
5. Send a spam mail and check where it goes
Just copy all those lines from this url and send a mail. This mail should go to your spam folder called caughtspam.
If there is any problem occur, then check all those settings and test again. You also can see some possible causes from here.
Enable and configure Spamassassin on Cpanel
Those who are using cpanel web hosting they have a option to setup spamassassin on mail section. To enable and configure SpamAssassin just follow those instructions:
- Go to Cpanel and login using your ID and password
- On Mail section click SpamAssassin Icon
Currently SpamAssassin is disabled, so you have to enable it first. Just click the Enable SpamAssassin Tab.
Now we have to configure SpamAssassin. Just click the Configure SpamAssassin Tab.
You will see like this:
Score: you can set a level of spam mail (1-10) higher score has greater chance to go mail to spam list. but typically 5-6 is the optimum score to set.
Blacklist_form: you can put a specific mail address like bad@baddoma[email protected] or *@badmail.com (this will block all mails from badmail.com)
The global configuration file of SpanAssassin is /etc/mail/spanassassin/local.cf which extends to the local version ~/.spamassassin/user_prefs. You can change rules in this file as per your demand. Exampls are there. Say if you want to Block any email address permanently or allow any email for ever, you should use below example:
# whitelist Sifat Peter: whitelist_from [email protected]
SpamAssassin is a important tools to save our resource and time for emailing. Just install and configure from above discussion, if you still have questions, please mentions it on our comment section.