4 .TH SLOCAL %manext1% "%nmhdate%" MH.6.8 [%nmhversion%]
6 slocal \- asynchronously filter and deliver new mail
11 [address\ info\ sender]
22 .\" \%[\-home\ homedir]
27 .RB [ \-verbose " | " \-noverbose ]
34 is a program designed to allow you to have your inbound
35 mail processed according to a complex set of selection criteria.
36 You do not normally invoke
40 is invoked on your behalf by your system's Message Transfer Agent
43 when the message arrives.
45 The message selection criteria used by
46 .B slocal is specified
48 .RI \*(lq \&.maildelivery \*(rq
49 in the user's home directory.
50 You can specify an alternate file with the
53 option. The syntax of this file is specified below.
55 The message delivery address and message sender are determined from
56 the Message Transfer Agent envelope information, if possible.
59 the sender will obtained from the UUCP
60 \*(lqFrom:\*(rq line, if present. The user may override these
61 values with command line arguments, or arguments to the
67 The message is normally read from the standard input. The
69 switch sets the name of the file from which the message should be
70 read, instead of reading stdin. This is useful when debugging a
71 .RI \*(lq \&.maildelivery \*(rq
78 the name of the user for
79 whom it is delivering mail. The
83 the name of the user's maildrop file.
87 switch may be used to pass an arbitrary argument to
90 may invoke on your behalf.
96 to give information on
97 stdout about its progress. The
100 verbose debugging output on stderr. These flags are useful when
101 creating and debugging your
102 .RI \*(lq \&.maildelivery \*(rq
104 allow you to see the decisions and actions that
106 is taking, as well as check for syntax errors in your
107 .RI \*(lq \&.maildelivery \*(rq
110 .SS "Message Transfer Agents"
111 Most modern MTAs including
116 support a \&.forward file for directing incoming mail.
117 You should include the line
120 \*(lq|\ %libdir%/slocal\ \-user\ username\*(rq
123 in your \&.forward file in your home directory. This will cause
126 on your behalf when a message arrives.
128 .SS "The Maildelivery File"
130 .RI \*(lq \&.maildelivery \*(rq
134 incoming mail. Each line of this file consists of five fields, separated
135 by white-space or comma. Since double-quotes are honored, these
136 characters may be included in a single argument by enclosing the entire
137 argument in double-quotes. A double-quote can be included by preceding it
138 with a backslash. Lines beginning with `#' and blank lines are ignored.
140 The format of each line in the
141 .RI \*(lq \&.maildelivery \*(rq
145 .B header pattern action result string
150 The name of a header field (such as To, Cc, or From) that is to
151 be searched for a pattern. This is any field in the headers of
152 the message that might be present.
154 The following special fields are also defined:
157 the out-of-band sender information
160 the address that was used to cause delivery to the recipient
165 if the message hasn't been delivered yet
173 The sequence of characters to match in the specified header field.
174 Matching is case-insensitive, but does not use regular expressions.
179 The action to take to deliver the message. When a message is delivered,
180 a \*(lqDelivery\-Date:\ date\*(rq header is added which indicates the date
181 and time that message was delivered.
184 This action always succeeds.
186 .IR file ", " mbox ", or " >
187 Append the message to the file named by
190 appended to the file in mbox (uucp) format. This is the format used by most
191 other mail clients (such as mailx, elm). If the message can be appended to
192 the file, then this action succeeds.
195 Pipe the message as the standard input to the command named by
197 using the Bourne shell
199 to interpret the string.
200 Prior to giving the string to the shell, it is expanded with the following
203 .TP \w'zzreplyztozaaa'u
205 the out-of-band sender information
206 .TP \w'zzreplyztozaaa'u
208 the address that was used to cause delivery to the recipient
209 .TP \w'zzreplyztozaaa'u
211 the size of the message in bytes
212 .TP \w'zzreplyztozaaa'u
214 either the \*(lqReply\-To:\*(rq or \*(lqFrom:\*(rq field of the message
215 .TP \w'zzreplyztozaaa'u
217 the out-of-band information specified
223 but executes the command
224 directly, after built-in variable expansion, without assistance from
225 the shell. This action can be used to avoid quoting special characters
226 which your shell might interpret.
229 Store the message in the
233 Currently this is handled by piping the message to the
237 although this may change in the future.
242 Indicates how the action should be performed:
245 Perform the action. If the action succeeds, then the message
246 is considered delivered.
249 Perform the action. Regardless of the outcome of the action,
250 the message is not considered delivered.
253 Perform the action only if the message has not been delivered.
254 If the action succeeds, then the message is considered delivered.
257 Perform the action only if the message has not been delivered
258 and the previous action succeeded. If this action succeeds, then the
259 message is considered delivered.
261 The delivery file is always read completely, so that several matches
262 can be made and several actions can be taken.
265 .SS "Security of Delivery Files"
266 In order to prevent security problems, the
267 .RI \*(lq \&.maildelivery \*(rq
268 file must be owned either by the user or by root, and must be
269 writable only by the owner. If this is not the case, the file is
273 .RI \*(lq \&.maildelivery \*(rq
274 file cannot be found, or does not
275 perform an action which delivers the message, then
277 will check for a global delivery file at
278 .IR %etcdir%/maildelivery .
279 This file is read according to the same rules. This file must be
280 owned by the root and must be writable only by the root.
282 If a global delivery file cannot be found or does not perform an
283 action which delivers the message, then standard delivery to the
284 user's maildrop is performed.
286 .SS "Example Delivery File"
287 To summarize, here's an example delivery file:
290 .ta \w'default 'u +\w'mh-workersxx 'uC +\w'destroy 'uC +\w'result 'u
292 # .maildelivery file for nmh's slocal
294 # Blank lines and lines beginning with a '#' are ignored
296 # FIELD PATTERN ACTION RESULT STRING
299 # File mail with foobar in the \*(lqTo:\*(rq line into file foobar.log
300 To foobar file A foobar.log
302 # Pipe messages from coleman to the program message-archive
303 From coleman pipe A /bin/message-archive
305 # Anything to the \*(lqnmh-workers\*(rq mailing list is put in
306 # its own folder, if not filed already
307 To nmh-workers folder ? nmh-workers
309 # Anything with Unix in the subject is put into
311 Subject unix file A unix-mail
313 # I don't want to read mail from Steve, so destroy it
314 From steve destroy A \-
316 # Put anything not matched yet into mailbox
317 default \- file ? mailbox
320 * \- pipe R %libdir%/rcvtty
323 .SS "Sub-process environment"
324 When a process is invoked, its environment is: the user/group-ids are
325 set to recipient's ids; the working directory is the recipient's home
326 directory; the umask is 0077; the process has no /dev/tty; the standard
327 input is set to the message; the standard output and diagnostic output are
328 set to /dev/null; all other file-descriptors are closed; the environment
333 are set appropriately, and no other environment variables exist.
335 The process is given a certain amount of time to execute. If the process
336 does not exit within this limit, the process will be terminated with
337 extreme prejudice. The amount of time is calculated as ((size / 60) +
338 300) seconds, where size is the number of bytes in the message (with
339 30 minutes the maximum time allowed).
341 The exit status of the process is consulted in determining the success
342 of the action. An exit status of zero means that the action succeeded.
343 Any other exit status (or abnormal termination) means that the action
346 In order to avoid any time limitations, you might implement a process
349 The parent would return the appropriate
350 value immediately, and the child could continue on, doing whatever it
351 wanted for as long as it wanted. This approach is somewhat risky if
352 the parent is going to return an exit status of zero. If the parent is
353 going to return a non-zero exit status, then this approach can lead to
354 quicker delivery into your maildrop.
359 .ta \w'%etcdir%/ExtraBigFileName 'u
360 ^$HOME/\&.maildelivery~^The file controlling local delivery
361 ^%etcdir%/maildelivery~^Rather than the standard file
362 ^%mailspool%/$USER~^The default maildrop
366 rcvdist(1), rcvpack(1), rcvstore(1), rcvtty(1), mh\-format(5)
371 .RB ` \-maildelivery "' defaults to $HOME/\&.maildelivery"
372 .RB ` \-mailbox "' deaults to %mailspool%/$USER"
373 .RB ` \-file "' defaults to stdin"
374 .RB ` \-user "' defaults to the current user"
382 was originally designed to be backward-compatible with
388 .RI \*(lq \&.maildelivery \*(rq
389 file syntax is somewhat limited. But
391 has been modified and extended, so that is it no longer compatible with
394 In addition to an exit status of zero, the
400 (9) mean that the message has been fully delivered.
401 Any other non-zero exit status, including abnormal termination, is
407 \*(lquse an alternate route\*(rq (deliver the message to the maildrop).
409 The `suppress duplicates' function had been removed from slocal for
413 Only two return codes are meaningful, others should be.
416 was originally designed to be backwards-compatible with the
418 functionality provided by