How to configure K9
Overview - What is it and how does it work?!
K9 is an email filtering program that works in conjunction with most popular email applications that use the standard POP3 email protocol. Messages pass through K9 on their way to your email program and as K9 processes them it can learn to identify the difference between Spam and Good emails, marking Spam emails so that your email application can file them away or delete them.
Initially K9 will not know what is Spam or Good email so you need to correct it when it gets things wrong. Over time you'll find that you have to correct K9 less often as it learns from past mistakes. Eventually you'll only rarely need to correct K9.
In summary this is how it works.
- You configure your email application to retrieve emails via K9. Emails are retrieved by your regular email program but pass through K9 before reaching it.
- When passing through K9, each message will be analyzed and based upon previous emails it will determine if the message is Spam or Good. K9 marks Spam emails in a special way.
- When the emails arrive in your email application you use its built-in filtering rules to look for the special spam marker placed there by K9. If the marker is present the rule can automatically place the email wherever you like, for example in a Spam folder, or simply delete it. In this way you'll no longer have to manually sift through dozens and dozens of emails looking for the occasional good message amongst the junk. The hard work will have already been done for you by K9!
Creating an email program rule to move Spam to another folder
K9 tags Spam emails with a special marker that you need to configure your email program to look for so it will file spam emails away in a place of your choosing.
When your email client checks emails they will now flow through K9's proxy where K9 will classify and mark each email as it passes through.
There are 3 different ways in which K9 can mark an email as Spam, selected via the Mark emails as spam by... section in the Configuration tab. The idea is to mark each Spam email in such a way as for your email program to use a built-in filter rule to identify the marker in an email and based on that rule move the Spam to a specified folder or to simply delete it.
The default Spam marking option in K9 is to append the word [Spam] to the end of the email's Subject line. Outlook Express message filtering rules are rather crude and about the only useful thing you can filter on is the Subject line. Therefore, the default Mark emails as spam by... | Appending [Spam] to the Subject line option in K9's configuration settings can be used. You can set up a rule in your email program to look for emails that contain [Spam] in their Subject line and move the email to a specified folder.
One of the other Spam marking options in K9 it to append an email header line of your choice for use with email programs that can create rules based on such things. A common suggestion is to use the header X-Text-Classification: spam and filter on a header line containing this in the email application. This option is preferred if your email application supports it and looks cleaner since you never get to see any visible evidence of how K9 was able to identify the email as Spam.
Here are basic instructions for creating an email moving rule in Outlook Express.
- Right click on your Inbox folder on the left side and select New folder... from the menu.
- Enter the name Spam or Junk or whatever you like in order to identify junk emails that will be placed here and click OK.
- Select the Tools | Message Rules | Mail... menu option to bring up the Message Rules window.
- Click the New button.
- In the first box select and check the item labeled Where the Subject line contains specific words.
- In the rule description pane (3) near the bottom click on the blue link that says contains specific words.
- In the window that appears enter the text [Spam].
- Click the Add button.
- Click the OK button.
- In the Select the Actions for your rule section (2) select Move it to the specified folder.
- In the rule description pane (3) near the bottom click on the blue link that says specified.
- Select the Spam folder you created and click OK.
- In the name of the rule box (4) at the bottom enter something meaningful like Spam.
- Click OK.
- Back at the main Message Rules window it is advisable to move your newly created rule to the top of the list by selecting the rule and clicking the Move Up button until the rule is at the top.
- Click OK to dismiss the Message Rules window.
For other email programs you just need to create a new folder in which you want to place Spam emails and create a rule to look for the word [Spam] in the Subject line or, since most other email programs have better filtering capabilities than Outlook Express, you can choose to filter emails based on an email header of your own creation so long as you configure K9 to add it. To do this you'll need to go to the K9 Configuration window and select the appropriate option from the Mark emails as Spam by... section.
Configuring your email program to talk to K9
The basic steps here are to change your email program POP3 account(s) to talk to the K9 proxy server. You'll be changing the POP3 server port number from the default (usually 110) to instead use K9's port of 9999. You'll change the POP3 server address to be 127.0.0.1 and then you'll need to change the user name to be OriginalPop3Server/OriginalPort/OriginalUserName. See below for the details.
- Open your email program.
- Run K9.
- On running K9 for the first time, if you are using Microsoft Outlook or Outlook Express K9 will offer to configure your email settings for you. If you choose to do this you don't need to read any further in this section.
- In your email program make a note of the POP3 server port number for the same account (usually 110). Change this to 9999. In Outlook Express you'll find this information by selecting Tools | Accounts.... Select the email account from the Mail tab and click Properties. Select the Advanced tab and change the port number in the Incoming mail (POP3) box to 9999. Here's a screenshot.
- In your email program make a note of the POP3 server address for the account you will be using. Change this to 127.0.0.1.
- The user name should be changed to incorporate the original values from the above two steps into one character string.
Here's an example.
Suppose your original user name value was robin and the original POP3 server was pop.west.cox.net and the original POP3 port number was 110. The new user name entry would now look like pop.west.cox.net/110/robin.
If your user name happens to contain the character "/" you can use a different character but (a) make sure you use the same character to separate the different parts and (b) change the delimiter character in the Configuration tab in K9 to match the character you chose, then hit Apply.
Here's a screenshot from Outlook Express showing the above settings.
Run your email application as usual. When you have email and you have K9 set to minimize down to an icon in the system tray area (see the K9 Configuration page) you may notice its icon flashing as email is passing through on its way to your email program.
In your email program it will receive email as usual except that if you have setup the automatic filtering rule as described above all of the emails identified by K9 as spam will now have been placed in your new Spam folder leaving your Inbox with only Good emails.
When It Gets Things Wrong
If you find that K9 has mis-identified emails as Spam or Good, which is quite likely to begin with, open up K9 and go to the first tab - Recent Emails. The latest batch of emails that were fed through K9 will be highlighted in bold. Select and re-classify any emails that it got wrong by highlighting the messages and clicking Good or Spam accordingly. This is how K9 learns!.
You will find that over time K9 becomes more intelligent as you tell it what is Spam and what is not, to the point where you almost never have to correct it again.
Note that it is up to you to move incorrectly identified emails from the folder they were moved into by your email program back to where they belong i.e. you'll have to move an email mis-identified as spam from your email program Spam folder back into the Inbox.