4 There is one file per user. (If there is no rules file for an user, mail are
5 just delivered to its default folder 'INBOX'.)
7 You can check configuration file from command line by using mail.filter '-c'
8 option. mail.filter will report any syntax error found in the file given as
9 argument. It's HIGHLY recommended to test change with this method prior to
10 "commiting" change to user's configuration.
15 The syntax is very simple.
17 expr = keyword string* { expr* }
20 In english, that mean that an expression is a keyword followed by optionally
21 one or more "string", then followed by end of expression character ';', or
22 followed by nested expression enclosed by {}.
26 folder 'Spam' { spam ; }
31 The file contains a set of actions. Each action contains a match description.
33 Some examples of action:
36 header 'from' contains '<some@email.address.com>' ;
37 header 'from' match '@joedomain\.(com|net|org)>' ;
38 header 'subject' contains '[joe]' ;
41 folder 'Store.Amazon' {
42 header 'to' is 'some@email.address.com' ;
45 header 'from' is 'confirmation-commande@amazon.fr' ;
46 header 'from' is 'confirmation-envoi@amazon.fr' ;
47 header 'from' is 'modification-commande@amazon.fr' ;
49 header 'to' is 'another@email.address.com' ;
54 header 'from' contains '<some@email.address>' ;
58 In the current mail.filter, there is two possible action.
60 Either 'folder' or 'reject'.
66 Syntax: folder <folder-name> { matches.. }
68 The 'folder' action instruct mail.filter to file the mail into a particular
69 folder. So, folder take one argument that give the folder name.
75 Syntax: reject <error-code> { matches.. }
77 The 'reject' action instruct mail.filter to not file the mail, and instead
78 return an error code to sendmail.
80 Supported textual error code are: nouser, tempfail and dataerr.
82 But, reject can also take a numeral error code.
88 For matches listed in action, only one need to match for the action to be
89 taken (logical 'or' by default.)
91 The following matches are supported:
96 Syntax: header <HEADER-NAME> <MATCH-TYPE> <MATCH-ARGUMENT> ;
100 * HEADER-NAME name a header, where all blanks character sequence are
101 considered as just one space character.
103 HEADER-NAME can optionnaly be followed by one of the following
104 extension to match a subset of the text in the header:
107 - '.name' extract the name part.
108 - '.address' extract the email address part.
109 - '.user' extract the username before the @ in email address.
110 - '.domain' extract the domain name of the email address.
112 Example with header 'From: Frederic Jolliton <frederic@jolliton.com>, a@b.c (Foo)':
114 'From.name' -> [ 'Frederic Jolliton' , 'Foo' ]
115 'From.address' -> [ 'frederic@jolliton.com' , 'a@b.c' ]
116 'From.user' -> [ 'frederic' , 'a' ]
117 'From.domain' -> [ 'jolliton.com' , 'b.c' ]
119 * MATCH-TYPE give the type of match to perform against the header.
120 Each match type take an argument.
122 * 'is' test if the header is equal to the argument (case
124 * 'contains' test if argument appear in header (case insensitive.)
125 * 'match' test if regular expression defined by argument match
133 Test if the mail was parsed correctly. Usefull to move such mail apart from the
134 INBOX, since most of the time they are spams or viruses.
141 Test with clamav if the mail contains a virus.
148 Test with spamprobe if the mail *could* be a spam.
150 Note that spamprobe need to be "enseigner"(fr->en?).
152 Match 'and', 'or' and 'not'
153 ---------------------------
155 These matches allow you to build logical conditions.
161 For 'and', everything inside it must match.
162 For 'or', only one match is required.
163 For 'not', everything inside must don't match.
169 folder 'Store.Amazon' {
170 header 'to' is 'some@email.address.com' ;
173 header 'from' is 'confirmation-commande@amazon.fr' ;
174 header 'from' is 'confirmation-envoi@amazon.fr' ;
175 header 'from' is 'modification-commande@amazon.fr' ;
177 header 'to' is 'another@email.address.com' ;
181 Here we fill mail to 'Store.Amazon' IMAP folder for the user specified on
182 command line (which sendmail automatically set when calling the script)
183 when mail match the following:
187 - The mail is destined to 'some@email.address.com',
188 - OR The mail is both:
189 - destined to 'another@email.address.com'
190 - AND from one of the three emails address listed.