|
Creating message filters in pineCopyright Phillip Farrell. Last revision June 9, 2006 The pine email program has a flexible system for creating filters to process your incoming email. These filters can be used to collect certain types of messages into special email folders, or even discard them. This note demonstrates how to use filters in pine with the example of creating a filter to handle spam email on pangea. However, it is more efficient to use the new Spam Deletion function of the pangea account maintenance web server, which deletes or moves spam messages before they even get into your email INBOX. The same steps shown here for creating a spam filter in pine could also be used to filter messages into folders by subject or correspondent. The email system on pangea runs the Sophos PureMessage program to recognize likely junk email and flag it by modifying the subject line to include the keyword SPAM: followed by one to five hash marks indicating probability that this email message is actually "spam". That keyword is also enclosed in square brackets. See the note on spam filters on pangea for more information. In my experience, email messages flagged by pangea as likely spam with three or more hash marks are always spam and never legitimate email, whereas some of my legitimate email (some mailing lists in particular) get flagged as possible spam with one or two hash marks. So, I am going to show how to create a filter in pine that simply discards all incoming email that is marked as likely spam with three or more hash marks. Please remember that this filter in pine only deletes the likely spam messages when pine is run to process my incoming email. The email message is marked as likely spam and delivered to my INBOX by the system programs on pangea, and then pine removes it as it reads the INBOX. If I switch to another program to read my email, such as pangea's webmail system, I will still see those spam messages in my INBOX, unless I setup a similar filter in that program to delete them. Or better yet, use the new Spam Deletion function of the pangea account maintenance web server to keep spam from ever making it to my INBOX. This tutorial uses pictures of my terminal screen as I am working in pine. Some of the screenshots have been cut down to just show the relevant portion. I must start in pine's main menu, as shown below.
When I first startup pine, I will be in the main menu. If I am reading mail, I can switch back to the main menu by simply pressing the M (Main Menu) key. As I have highlighted above, I want to select the SETUP screen. I simply press the S key, which then switches to this view of the setup options:
There are more setup options than can fit on one screen, so I press the SPACE bar to scroll down to this next screen:
Here you see the option to create Rules. This is what I want, so I press the R key. There are several types of rules, so I am given this prompt to select among them:
I press the F key to select Filters, and I am then presented with this screen:
As the message shows, I have to use the Add function to add a new filter. I do this by pressing the A key, which then takes me to the Add a Filtering Rule screen:
The first thing I have to do is give this filter a name. The Nickname field is already selected, but if it were not, I would use the arrow keys as I normally do in pine to move the cursor to that line and select it. I now press the C (Change Val) key and pine prompts me to enter "replacement text" for the Nickname field. The default name of Filter Rule is shown and highlighted.
I type any name I like, in this case, SPAM, to replace the default name.
Pressing the RETURN key puts my new name into effect and returns me to the Add a Filtering Rule screen. The bottom of this screen shows some of the conditions I can use to filter messages. There are too many options to fit on a single screen, so I press the space bar to get to the next screen, where I highlight the option to filter on Subject pattern using the arrow keys:
As you can see, no value has been set yet for filtering. I press the C (Change Val) key and am then prompted to enter the text that will be searched for in the Subject: line of each incoming email message in order to find the messages that should be filtered:
Because my experience shows that messages flagged in the Subject: header by the PureMessage program on pangea with the SPAM: keyword and three or more hash marks are always spam, I type in [SPAM:### as the text to look for in the Subject: line. Obviously, this will match whether there are three, four, or five hash marks. When I press the RETURN key, the filtering conditions are updated to look for this text in the Subject: line of each message. I then press the space bar to advance through other screens of possible filtering options, such as message status, until I get to the "Actions" section of the filtering rule:
By default, the action is to move the messages that match the filtering rules (in my case, messages with the text [SPAM:### in the Subject: line) out of the INBOX and into a new mail folder. I want to simply discard these messages. So I use the arrow keys to highlight the line that says Delete and then I must press the asterisk key (*) (normally shift-8) to select Delete as the action. Just highlighting that line is not enough. I must also press the asterisk key to switch the action to it:
If I'm afraid that some of my legitimate email might be marked as high probability spam by the PureMessage program on pangea, I can instead keep the default action, which is to save these messages in a separate folder. Then I can periodically scan through that folder looking for any real mail, and deleting the rest. If I try this alternative, and find that all the mail marked as spam really is spam, then I can return to this filtering rule and modify it to simply delete these messages. To alternatively save the spam messages in a new mail folder, for example, spamfolder, I keep the default Move action and use the arrow keys to highlight the next line that specifies the Folder List.
Now, I press the C (Change Val) key and I am prompted to enter the name of the folder where spam messages will be stored:
I enter the text spamfolder. Pressing the RETURN key accepts my name and then returns me to the filtering rule screen. Whether I am deleting the spam messages, or moving them to another folder, I'm done creating my filtering rule, so I now press the E (Exit Setup) key. Pine now prompts me to confirm that I want to keep these new settings:
I press the Y (Yes) key. If I gave the name of a folder to store spam messages (rather than simply deleting them), but that folder does not exist, I am now prompted to confirm that it should be created:
Again, I press the Y (Yes) key. These confirmations return me to the Setup Filtering Rules main screen. Once again, I press the E (Exit Setup) key to indicate that I am done creating or editing filtering rules, and am prompted to confirm that my changes should be kept:
I press the Y (Yes) key, and am returned back to the main menu, where I began. My filtering rule goes into effect immediately. Pine scans my INBOX to find any messages that match the rule and then dispose of them as I requested (in this case, move to a separate folder):
With my spam filtering rule defined, every time I start pine it will scan all the messages in my INBOX to find those that match the rule (high probability spam messages) and take the action I specified. While I have the pine program running, new email messages are scanned and processed as they arrive, so I never see any of these high probability spam messages in my INBOX message list.
|