Page 50 - Mercury Manual.book
P. 50

45     Mail Filtering Rules
                Advanced rule processing options



                  If subject is Subscribe then Send text file 'WELCOME.TXT'
                  If subject is Subscribe then Move message to subscription directory
                  If subject is Unsubscribe then Remove sender from list
                  If subject is Unsubscribe then Send text file 'GOODBYE.TXT'
                  If subject is Unsubscribe then Move message to subscription directory

               Note the repetition of the match field to force several rules to apply to the same message. Re-
               member when designing rules like this that any rule resulting in the message being moved or
               deleted must be the last rule in the set, because Mercury stops processing rules when this hap-
               pens.

               Advanced rule processing options



               Most of the time, you will probably use rules simply to automate the printing, forwarding and
               auditing of your mail, and to remove unwanted messages automatically from the system;
               sometimes, though, you may want to do much more complex things with the rule facility, like
               applying multiple tests to a message (this is called logical operation) or controlling the order
               in which rules are processed. This section provides information on these more advanced uses
               of rules and assumes that you are already familiar with the basic uses – if you are not, please
               spend some time familiarizing yourself with the basics before tackling these advanced topics.
               Flow Control

               Many times, you may find that there are certain groups of rules that you want to apply repeat-
               edly in a rule set, or that you want to have more control over the order in which rules are proc-
               essed. This concept is called flow control, and Mercury provides six rule actions to support it
               - skip, exit, labels, call/return and goto.

               Skip  The simplest flow control operator is the Skip next rule action: when a rule triggers and
               this action is indicated, Mercury will skip over the next rule in the list without testing or ap-
               plying it. You can use this as a way of handling single exceptions to a general rule - for in-
               stance, imagine that you want to delete all messages where the subject contains the phrase
               free offer, except when that message comes from the address support@pmail.gen.nz - you
               would add the following two rules to your rule set:

                  If "From" field contains "support@pmail.gen.nz", then skip next rule
                  If "Subject" field contains "free offer", then delete message

               Exit  When a rule triggers that has the action Exit this rule set, all rule processing for the cur-
               rent message terminates at once - no more rules are examined or actioned. The primary use
               of this action is to separate subroutines, or groups of rules that you access via call label ac-
               tions, from the main body of your rule set.

               Labels  A label is simply a name you can add to any line in your rule set. Labels are used by
               return and goto actions (see below) to transfer processing to a different location in the rule
               set. Labels can appear anywhere in the rule set - when calling or going to a label, you can go
               either forwards or backwards. Labels are simply a textual name - you can use any text or let-
               ters you wish up to 45 characters in length. Labels, like comments, are passive items in a rule
               set - on their own, they do absolutely nothing, and they have no trigger conditions or associ-
               ated actions.

               Calls and returns  If you have defined a label in your rule set, you can call it at any time by
               defining a rule with the Call label action. If the rule triggers, processing of the rule set will
               transfer to the first rule after the label you name and will continue until either there are no
   45   46   47   48   49   50   51   52   53   54   55