Build your own Spam Filter

Unlike Outlook Express which stores everything in the registry, Netscape and Mozilla Mail store their email filters in a plain text file. This makes it much easier for you to add your own spam filters to any existing filters that you might have created.

The first thing that you need to do is to locate your spam filter text file. To find where the filters are located start your mail program (ctrl + 2 if you have the browser running) and in the Edit menu select Mail & Newsgroup Account Settings. Next select Server Settings from the list of settings pages on the left of the dialog for the particular email account definition that you want to update and you will see a field at the bottom of that page called Local Directory. That is the full address of the directory where you will find your mail filter text file for that particular email account. If you have multiple identities defined then you will have multiple Server Settings pages and multiple directories where email filters are stored.

Next close your email programme and navigate to the folder that was identified as the local directory. You will probably have to go through quite a few sub-sub-sub folders before you get to the one specified. Here you will find a file called rules.dat (if you are using Netscape mail) or msgFilterRules.dat (if you are using Mozilla mail). This is the text file that contains the message filters for your chosen email account.

If you haven't set up any email filtering yet the file will contain two lines like this:

version="8"
logging="no"

If you have already set up some rules then the first two lines will read as above followed by whatever rules you have created so far.

Provided that you have your email programm closed down we can edit this file to modify existing rules or to add more rules. This is the easiest way to create complicated filters to handle the processing of spam emails for you.

To make it even easier for you I am now going to supply you with some code that you can add to the end of the existing rules to help you to filter your emails. Before you add the following code you need to create a folder called junk within Local Folders in your email program. You can then just edit the filter file and add the following code to the end of the file.

name="spam1"
enabled="yes"
type="1"
action="Delete"
condition="OR (subject,contains,stop smoking) OR (subject,contains,weight loss) OR (subject,contains,obesity) OR (subject,contains,liposuction) OR (subject,contains,psychic) OR (subject,contains,penis) OR (subject,contains,whore) OR (subject,contains,viagra) OR (subject,contains,slut) OR (subject,contains,nude celeb) OR (subject,contains,fuck) OR (subject,contains,fisting) OR (subject,contains,erotica) OR (subject,contains,fetish) OR (subject,contains,bondage) OR (subject,contains,barely legal) OR (subject,contains,adult site) OR (subject,contains,adult video) OR (subject,contains,adult web) OR (subject,contains,adult entertainment) OR (subject,contains,exciting entertainment) OR (subject,contains,squirming) OR (subject,contains,god) OR (subject,contains,medication) OR (subject,contains,penile)"
name="spam2"
enabled="yes"
type="1"
action="Move to folder"
actionValue="mailbox://nobody@Local%20Folders/junk"
condition="OR (subject,contains,ADV) OR (subject,contains,get out of debt) OR (subject,contains,debt reduction) OR (subject,contains,credit card debt) OR (subject,contains,no credit card required) OR (subject,contains,get paid for) OR (subject,contains,get paid while) OR (subject,contains,low interest load) OR (subject,contains,low mortgage rates) OR (subject,contains,bad credit) OR (subject,contains,fire your boss) OR (subject,contains,make money on) OR (subject,contains,make more money) OR (subject,contains,want more money) OR (subject,contains,pile of cash) OR (subject,contains,save $) OR (subject,contains,save money) OR (subject,contains,win cash) OR (subject,contains,site need more traffic) OR (subject,contains,credit card payment) OR (subject,contains,debt removal) OR (subject,contains,winning streak) OR (subject,contains,grand opening) OR (subject,contains,poor credit) OR (subject,contains,suffer from) OR (subject,contains,guaranteed) OR (subject,contains,bucks)"

So what do these two filters (spam1 and spam2) actually do. Well we have added them to the end of the filter file so any other filters you have already created will be processed first meaning that if you already have filters to redirect expected mail into separate folders then none of the expected mail will reach the extra filters. (You can add such filters later and then change the order of your filters from within the mail program if you need to).

Only mail not redirected by earlier filters will reach these two new spam filters. These filters then examine the subject of the email to try to separate out spam from other emails. The spam1 filter looks for several common word combinations found in spam emails advertising pornography and also weight loss and similar programs. If any of these word combinations are found then the email will be deleted before you see it. You wont even know that emails containing any of these word combinations were ever received. The spam2 filter looks for word combinations related to other types of advertising and business opportunity spam. In this instance instead of immediately deleting the emails they are redirected into the Junk folder. This gives you the opportunity to quickly scan the list of emails in the junk folder to check that there aren't any emails that you really wanted and which ended up there by mistake. If there are you can easily move them back into your inbox before deleting the rest of the content of the junk folder.

I have set these two filters up this way because I know for certain that I don't want to see any emails that reference the word combinations that the first filter checks for whereas there may be an occasional email that the second filter checks for that I do want to see. If this arrangement doesn't suit you then it is a relatively simple change to switch search terms between the two filters or to combine the two into one.

Of course there will still be some spam that is not picked up from these filters but they do manage to filter out the majority of the spam that I am receiving.

One final note: You may want to direct all of your "spam" emails to the junk filter until such time as you are happy that the emails being filtered out are not ones that you actually want.

 

This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow
Donate