filter-rules(4) CLIX filter-rules(4)
NAME
filter-rules - Rules file used by filter command to sort mail
DESCRIPTION
The filter-rules file is used by the filter command and contains the rules
against which the incoming mail is filtered. The format for the rules
contained in the file is as follows:
rule ::= if (expression) then action
The conditions on expression are as follows:
expression ::= { not } condition expr2
expr2 ::= NULL | and condition expr2
condition ::= field relationship value | lines relop numvalue | always
These further break down as follows:
field ::= from | subject | to | lines
relationship ::= = | !=
relop ::= = | != | < | > | <= | >=
value ::= any quoted string
numvalue ::= any integer value
The action can be any of the following:
delete
save foldername
savecopy foldername
execute command
forward address
leave
The order of rules in the file is very important. When a message arrives,
it is filtered according to the first rule it matches. Sometimes this
method has an undesired effect, as a message which may fit one rule gets
filtered before it matches another more appropriate rule. Therefore,
great care must be taken with the ordering of the rules. (See the note
after the explanation of the rules of the sample filter-rules file in the
EXAMPLES section.)
EXAMPLES
This is a sample $HOME/.elm/filter-rules file for user Joe Smith.
# $HOME/.elm/filter-rules
#
# Filter rules for the Elm Filter program. Don't change
2/94 - Intergraph Corporation 1
filter-rules(4) CLIX filter-rules(4)
# without some serious thought. (remember - order counts)
#
# (for Joe Smith)
# rule 1
if (from contains "!uucp") then delete
# rule 2
to "postmaster" ? save "/tmp/postmaster"
# rule 3
if (to "culture" and lines > 20) ? save "/usr/Mail/smith/culture"
# rule 4
subject = "net question" ? forward "network!help-machine"
# rule 5
if [ subject = "ABC" ] savecopy "/usr/Mail/smith/project"
# rule 6
subject = "display-to-console" ? execute "cat - > /dev/console"
Each of the six filter rules is explained as follows:
rule 1: All messages from the network uucp are deleted.
rule 2: All mail addressed to postmaster is saved in a folder (that is,
a file) called /tmp/postmaster.
rule 3: All mail addressed to culture with at least 20 lines is
automatically appended to the /usr/Mail/smith/culture folder.
rule 4: All messages that contain the subject net question are forwarded
to the user smith, at the address network!help-machine.
rule 5: All messages with a subject that contains the acronym ABC are
saved in the /usr/Mail/smith/project folder and also copied into
the incoming mailbox.
rule 6: Any message with the subject display-to-console is immediately
written to the console.
Remember that the order of the rules is important. For example, if a
message from uucp that had the subject net question arrives, the filter
command matches rule 1 and deletes the message. It is never forwarded to
network!help-machine, according to rule 4. It is for this reason that
great care must be taken in the ordering of the rules.
CAUTIONS
Be sure to test the rules before installing the ruleset by entering the
filter -r command.
RELATED INFORMATION
Commands: elm(1), filter(1), sendmail(8)
2 Intergraph Corporation - 2/94
filter-rules(4) CLIX filter-rules(4)
The Elm User's and Reference Guides
2/94 - Intergraph Corporation 3