Using Filters in MR2/ICE
Julian Thomas

This is is adapted from an article I wrote that appeared in the October, 1997 issue of extended attributes, the monthly publication of POSSI (The Phoenix OS/2 Society). You can request a free sample copy and get membership information at their web site.

MR2/ICE (or mr2i) is my mailer (and newsreader) of choice for a number of good reasons. One of these is its powerful filtering mechanism which allows a variety of processing of incoming (and/or outgoing messages as well as news headers). In this article, I will attempt an introduction to some of the capabilities of filters, using the filters and auxiliary programs I wrote to manage a POSSI group buy of PMVIEW.

When you select filter maintenance and then New (to create a new filter) there are three filter definition screens:

This is the Criteria screen for the filter I use to move POSSI mailing list traffic to its own folder. Let's look at this in more detail. The description and tag fields are self-explanatory. The filter is enabled for inbound mail [I could have made it an In/Out filter, but since my own rantings are echoed by the listserv, I merely delete my sent messages from my outbox once they are echoed]. Search type is simple and limited to the To: field of the header. If the text string shown is found in that field, the filter will be activated, since we have specified Process When Message Matches. For this filter, the Action specifies to copy the message to a folder, in this case, my POSSI list folder.

This shows the Disposition: "Keep message out of the inbox/outbox; check no further filters". The next example will show use of the Action screen.

Here's the Filter Interchange File listing for this filter:

---------- Filter 16  FIF-level 1.35nf1 ----------
"Enabled"                                f1.1 1 +
"Filter description"                     f1.2 * POSSI listserv
"Filter alias"                           f2 * possi
"Search modes::  To "                    f3 # 2
"Search text"                            f4 * <MEMBERS@POSSI.ORG>
"Folder for copy :: F055 "               f6 * possi
"Filter type:: Inbound "                 f13.1 1 I
"Search type:: Simple "                  f13.2 1 S
"Match type:: Match "                    f13.3 1 M
"Copy to folder"                         f13.7 1 Y
"Disposition:: Delete NOW "              f13.13 1 Y

Now let's look at the group buy and how I used a filter (and an associated REXX program) to automate the process. As you may remember, those wishing to sign up for the buy were requested to send me email with a specific subject, which I used as the Criteria for my filter, as shown here:

In this case I used a Freeform search, which is more complex, but more powerful than a simple search. I wanted to use the logical operations to ensure that no replies to action messages (prefixed by Re:) would trigger the filter, and that any requests sent to the POSSI list would not add the list itself as a requestor [actually, I added that one after the horse had been stolen once and the list received my autoreply in error]. The codes (such as {F}) used in freeform expressions and the rules for making logical expressions are described in the Web-based maual, in filters.txt, (and also in the history.txt file distributed with mr2i).

Here is the Action for this filter. Note that a number of actions are specified. In addition to copying the messages to a dedicated folder (pmview buyers), I have also checked Autoreply (which in turn specifies a template for the autoreply message; the template contains the text for the message) and Link to Rexx to activate the possipmv.cmd program.

Here is the FIF listing for this filter, followed by the POSSIPMV.CMD listing:

---------- Filter 14  FIF-level 1.35nf1 ----------
"Not enabled"                            f1.1 1 -
"Filter description"                     f1.2 * possi pmview buyer
"Filter alias"                           f2 * pmviewbuy
"Search modes::  Subject "               f3 # 4
"Search expression"                      f4 *
"Folder for copy :: F056 "               f6 * pmview buyers
"Auto reply template"                    f7 * possipmview
"Rexx cmd to call on match"              f10 * possipmv.cmd
"Filter type:: Inbound "                 f13.1 1 I
"Search type:: Freeform "                f13.2 1 F
"Match type:: Match "                    f13.3 1 M
"Copy to folder"                         f13.7 1 Y
"Autoreply"                              f13.8 1 Y
"Link to Rexx"                           f13.12 1 Y
"Disposition:: Delete NOW "              f13.13 1 Y

/* mr2i filter aid to capture pmview buy addresses */ /* Julian Thomas 1997 */ outfil="possipmv.lst" parse arg msgfil . '@echo off' z=stream(outfil,'c','open write') z=stream(outfil,'c','seek <0') z=stream(msgfil,'c','open read') lin=linein(msgfil) do until (length(lin)=0) /* process header */ f='' rt='' lin=linein(msgfil) linx=translate(lin) /* test to see if we found it */ if pos("From:",lin)=1 then f=lin if pos("REPLY-TO:",linx)=1 then rt=lin end if rt>'' then parse var rt xx user else parse var f xx user lo=lineout(outfil,user) s=stream(msgfil,'c','close') s=stream(outfil,'c','close') exit

mr2i passes the filename of the message file to the Rexx program as an argument [in this case the file is only read, but it is possible to modify the file by a program as well]. The program opens the message file and a list file [seeking to the end of the latter], and then reads the header, looking for a Reply-to or a From line, which is parsed to extract the email address of the originator of the message. The Disposition for this filter is the same as for the other example (i.e. no futher processing). Note that this makes the sequence in which the filters are processed critical, and in fact the main filter definition screen provides for controlling this sequence. The possipmv.lst file contains the list of all who have sent the magic message, although I actually maintained the list in another file, and periodically imported the new entries from possipmv.lst into my master list, where I distinguished between those whose checks had been received and the others. By copying sections of my master list into other .LST files, I was able to use the mr2i address group facility to send out mailings, initially with the information on the final price and where to send the checks; subsequently either acknowledging checks or sending reminders/warnings.

Here are two of the group definition screens I used, taking advantage of the ability to specify a group by an external file (the figure shows both the initial Distribution Group Maintenance window and also the "Edit Group Address Entry" (after I had selected Add in the first window; then "Find an Address File" in the second window, and selected the appropriate file from the resulting file selection window). My reminder messages were sent out by first updating the pmvno$.lst file in the mr2ice directory, and then sending mail with a tag (alias or nickname) of pmvnotpd. Since the master list contained the email addresses of the buyers, it was used to send out the registration keys directly; the addresses were untouched by human hands.

Julian Thomas is a retired IBM engineer and programmer who uses OS2 for almost everything; he, his wife Mary Jane, and Matinicus [a red Maine Coon cat] now live in the beautiful Finger Lakes Wine Country of New York State.
Email Home