3 filter, list, deliver, token, vf \- filtering mail
43 A user may filter all incoming mail by creating
44 a world readable/executable file
45 .BI /mail/box/ username /pipeto.
46 If the file is a shell script, it can use the
47 commands described here to implement a filter.
50 provides simple mail filtering.
51 The first two arguments are the recipient's address and mailbox, that is,
52 the same arguments provided to
54 The remaining arguments are all pairs of a regular expression and a file name.
55 With no flags, the sender's address is matched against each
56 regular expression starting with the first. If the expression
57 matches, then the message is delivered to the file whose name
58 follows the expression. The file must be world writable and should
60 A message that matches none of the expressions is delivered into
61 the user's standard mail box.
65 matches each regular expression against the message's sender.
70 to match against the entire header,
75 to match against the entire message (header and body).
77 For example, to delete any messages of precedence bulk, place in
83 /bin/upas/filter -h $1 $2 'Precedence: bulk' /dev/null
86 Three other commands exist which, combined by an
88 script, allow you to build your own filter.
98 to check each address contained in the
100 against a list of patterns in
102 Patterns come in four forms:
103 .TF ~\fIregular-expression\fP
106 .B ~\fIregular-expression\fP
107 If any address matches the regular expression,
109 returns successfully.
112 If any address exactly matches
115 returns successfully.
117 .B !~\fIregular-expression\fP
118 If any address matches the regular expression
119 and no other address matches a non `!' rule,
121 returns error status "!match".
124 If any address exactly matches
126 and no other address matches a non `!' rule,
128 returns error status "!match".
130 If no addresses match a pattern,
134 The pattern file may also contain lines of the form
140 to allow pattern files to include other pattern files.
141 All pattern matches are case insensitive.
143 searches the pattern file (and its includes) in order.
144 The first matching pattern determines the action.
152 for each address in the
154 that doesh't already match a pattern.
157 with only one argument, prints to standard output a unique token
158 created from the current date and
160 With two arguments, it checks
162 against tokens created over the last 10 days with
164 If a match is found, it returns successfully.
167 delivers into mail box
169 the message read from standard input.
170 It obeys standard mail file locking and logging
173 .B /sys/src/cmd/upas/filterkit/pipeto.sample
176 using the filter kit.
180 .BR /sys/src/cmd/upas/filterkit/pipefrom.sample ,
181 is provided which adds all addresses of your outgoing
182 mail to your pattern file.
183 You should copy it into a directory that normally gets
184 bound by your profile onto
189 takes a mail message as standard input
190 and searches for executable MIME attachments,
191 either rewriting them to be non-executable or
192 rejecting the message.
193 The behavior depends on the attachment's file name
194 extension and MIME content type.
196 contains the list of known extensions and MIME content types.
197 The fifth field of each line specifies the
198 safety of a particular file type:
202 (maybe; treated same as yes),
211 allows attachments with safety
215 to pass through unaltered.
216 Attachments with safety
218 both are wrapped in extra MIME headers
221 appended to their file names, to avoid
222 automatic execution by mail readers.
223 Attachments with safety
231 all Microsoft executable extensions)
233 cause for the entire message to be rejected.
239 causes the previous extension to be tested,
242 is treated the same as
246 .B /mail/lib/validateattachment
247 exists and is executable,
249 runs it on all attachments with safety
251 (attachments it would normally sanitize).
253 .IR validateattachment 's
254 exit status contains the string
257 rejects the entire message.
258 If the status contains the string
261 does not sanitize the attachment.
264 sanitizes the attachment as before.
266 .I validateattachment
269 to determine the file type.
270 It accepts text and image files
271 and discards messages containing
276 archives of executables.
282 not to sanitize MIME attachments, but instead to
283 reject messages it determines to be viruses.
288 to log all attachments of safety
293 .TF /mail/lib/validateattachment
295 .B /mail/box/*/pipeto
301 .B /mail/lib/validateattachment
304 .B /sys/src/cmd/upas/send
306 .B /sys/src/cmd/upas/filterkit
308 .B /sys/src/cmd/upas/vf