# 3.5. Filters

After using Kmail for a while, you may find that you have trouble sorting out the new messages in your inbox when they arrive. Filters allow you to automatically perform certain actions on incoming messages and to manually perform actions on selected messages in a folder.

The actions section of the Filter Rules window lets you perform up to eight actions in one filter. You can you the "Skip Rest" option to skip the rest of the actions in the list. Only the transfer action and the skip rest action are supported at this time, but expect to see more action options available in future releases of Kmail.

Usually, filters are used on incoming messages, but they can also be applied to a message or group of messages. To selectively filter messages in a message folder, select the messages you want to filter and type CONTROL-J or select Message | Apply Filters. Note that this will apply all of your filters to that message; there is no way to apply only certain filters to a message.

If you ever need to remove a filter, select it from the Filter Rules window and press the Delete button.

## 3.5.1. Filter Examples

If I am subscribed to the KDE User List, I could create a folder for the list (I'll call it KDE-User) and use a filter to automatically transfer new messages from my inbox to my KDE-User folder if they are from the KDE User List. Here is how to create this filter:

1. Think of a unique way of identifying the messages you want to filter. The unique property of my KDE User List messages is that they always contain the phrase "KDE User List" in the To: field. If I wanted to be even more specific, I could use the email address of the KDE User List.

2. Select Filter... from the File menu.

3. Press the New button to create an empty filter.

4. Select the empty filter from the list. (It will appear as a pair of angled brackets: <>).

5. The right side of the Filter window contains two sections: matching criteria and actions. In the matching criteria area, select "To:" from the first pull-down menu, "Contains" from the second pull-down menu, and type "KDE User List" in the text field.

6. Skip down to the actions section. Select "Transfer" from the first pull-down menu. A new pull-down menu containing a list of folders will appear. Select the folder that you want the filtered messages to be transferred to if they match the criteria you selected. For this example, you would select "KDE-User" from the pull-down menu.

7. Select "Skip Rest" from the next pull-down menu.

8. To save and try out your new filter, hit the OK button. This will also dismiss the window.

You may find that you need to use more complicated criteria to properly filter your messages. For example, you may only want to save the KDE User List messages that are written by your friend Fred Johnson <fj@anywhere.com>. This is where the rest of the matching criteria section comes into play:

1. Open up the Filter Rules window and select the filter you just created.

2. Since you want to filter all messages that have "KDE User List" in the To: field AND that are from Fred, select the AND option from the pull down menu between the two criteria sections.

3. Now, go to the bottom criteria section and select the following from the pull-down menus: "From:", "Contains." Now, type "fj@anywhere.com" in the text field.

4. Select "Skip Rest" from the next pull-down menu.

You now have a filter that transfers all KDE User List messages that are from Fred Johnson.