This column is a continuing feature of Benchmarks intended to present news and information on various aspects of wide area networks.

The Network Connection

[plug.gif]

By Dr. Philip Baczewski, Assistant Director, Academic Computing Services, and BITNET INFOREP (ac12@unt.edu)

Controlling Your E-Mail

If you are an active user of electronic mail, you may have found yourself wishing for a way to organize your incoming messages, without having to sort through them one by one. Wouldn't it be nice if mail from mailing lists ended up grouped together? Don't you wish that messages with subjects of subscribe or unsubscribe got deleted without your ever having to see them? On some E-mail systems, these sentiments are more than just idle wishes. The incorporation of rules-based message management into E-mail systems makes automated organization of your E-mail not just a wish, but a definite possibility.

A rules or filter facility can perform a number of functions on incoming E-mail based upon the content of the subject, the to or from fields, or the message body. The functions can include deleting the message, forwarding the message, filing the message, or even generating an automatic reply. Not all E-mail systems have this capability, but it is more and more frequently being built into new releases of E-mail software.

The Pegasus Mail Rules Facility

Pegasus mail allows you to invoke rules to organize your incoming mail through the preferences menu in the DOS version (the Macintosh and Windows versions do not yet support a rules feature). To define a rule you can select Preferences from the main menu and select New mail filtering Rules from the preferences menu. At this point, you can configure four items which make up the rule. The items are: the field to scan, the string to find, the action to take if the string is found, and a parameter associated with the desired action. The following example may help illuminate this facility:

 If this field       :  From, Cc, To
          Contains         :  netman-l
          Then do this   :  Move
         (Using)                Network Managers List
       

In the above example, if the mail From, Cc, or To field contains the string netman-l , then the message will be moved to the Network Managers List Pegasus mail folder. Pegasus mail will also scan the Subject and Reply-To fields as well. The actions available are as follows:

Copy Move Delete Forward eXtract Append Print Send text file send Binary file add user to List Remove from list Run a program

The "Using" item is only invoked when the action selected requires additional information. For example, if you move or copy a message, you will need to indicate a destination folder. If the action is forward, you will need to specify a forwarding address, etc. Other actions, like delete, require no additional information to be performed.

With the above set of functions, you can get quite creative in having Pegasus mail automatically manager your incoming mail. You can have messages from different mailing lists filed in different folders, and you can delete messages which you know will not interest you (like subscribe requests to mailing lists). You can allow people to automatically retrieve information from you by using the Send text file or send Binary file actions. These could be based on finding a string like sendme file in the subject of a message.

Pegasus mail processes your rules each time you invoke the check for New mail option. One tip is to not get too complicated with your rules, or it may take a while for Pegasus mail to execute all the specified functions and open your in box. On the other hand, this feature of Pegasus mail is one which should not be overlooked as a timesaving utility.

Using Filter on UNIX Systems

On UNIX systems where the E-mail package ELM is installed (including Sol and Jove), there is usually a program named filter available as well. Filter is an E-mail filter program which allows you to implement simple rules for manipulating incoming messages. To use filter, you must create a file named filter-rules in your .elm directory. The rules are constructed with the syntax, " if (condition) then action."

"They can be as simple as: if (subject contains subscribe ) then delete"

Other elements that can be specified in a condition expression are from, subject, to, lines, and sender. A usual condition expression is in the form, field-relation-value, so you could also construct a rule as follows: if (sender="bob") then save bobfolder.

This rule would save all messages from the mythical Bob into a specific folder.

For more information about filter, see the filter man page on UNIX. You can also refer to the ELM Filter User's Guide, which on Sol and Jove can be found as /pkg/sol/elm~1/src/doc/Filter.guid. You can view this file by using the command, nms /pkg/sol/elm~1/src/doc/Filter.guid.

Procmail, a More Powerful Alternative to Filter

Another program available to automatically manage your incoming electronic mail is named Procmail. This program runs on computers running UNIX, and is installed at UNT on Sol and Jove. Procmail has the ability to scan a message's body as well as the header. This feature, along with some additional functionality make Procmail a bit more powerful than Filter. Since Procmail is installed on Sol and Jove as a primary mail delivery agent, using Procmail only requires that you create a .procmailrc file to hold your rules, or in Procmail terminology, recipes.

You can put comments in this file by beginning the line with a pound sign (#).
A line starting with a colon (:) begins all Procmail recipes. The colon is followed by a number which indicates how many conditions are to be checked within that recipe. One or more optional flags, which indicate how a recipe will be processed, follow the number. The last item on a recipe's first line is a colon. The subsequent lines of a Procmail recipe, are the conditions to be checked, with each condition occupying its own line. An action line follows any of the condition lines.

The flags available are as follows:

Conditions for Procmail are written as regular expressions. The value ^TO starting regular expression will be replaced with the expression ^(To|Cc| Apparently-To):.*. The caret (^) indicates that the text following it should occur at the beginning of a line. The following is an example condition that would match any message sent to the SAS mailing list: ^TOsas-l

The following would match the string subscribe in the subject field: ^Subject:.*subscribe

Actions can be as simple as specifying a folder name into which a message will be filed. Mail can be forwarded in an action by putting an exclamation point (!) immediately followed by an E-mail address. An action can also be performed by using a pipe (|) followed by a command.

The following example would save any message from the SAS-L list in the saslist folder:

:w: 
^TOsas-l 
saslist

As is always the case when dealing with E-mail, you need to be careful when writing your rules. (System administrators do not look kindly on processes that end up creating E-mail loops - i.e. a forward to A causes a forward to B which forwards to A, etc.) If you are interested in using Procmail, see man procmail, man procmailrc, and man procmailex on Sol or Jove.


If you have problems or questions about this server, please contact me as soon as possible. You can send mail to the following address:

WWW@unt.edu