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 ]
28 .RB [ \-suppressdup " | " \-nosuppressdup ]
35 is a program designed to allow you to have your inbound
36 mail processed according to a complex set of selection criteria.
37 You do not normally invoke
41 is invoked on your behalf by your system's Message Transfer Agent
44 when the message arrives.
46 The message selection criteria used by
47 .B slocal is specified
49 .RI \*(lq \&.maildelivery \*(rq
50 in the user's home directory.
51 You can specify an alternate file with the
54 option. The syntax of this file is specified below.
56 The message delivery address and message sender are determined from
57 the Message Transfer Agent envelope information, if possible.
60 the sender will obtained from the UUCP
61 \*(lqFrom:\*(rq line, if present. The user may override these
62 values with command line arguments, or arguments to the
68 The message is normally read from the standard input. The
70 switch sets the name of the file from which the message should be
71 read, instead of reading stdin. This is useful when debugging a
72 .RI \*(lq \&.maildelivery \*(rq
79 the name of the user for
80 whom it is delivering mail. The
84 the name of the user's maildrop file.
87 is able to detect and suppress duplicate messages.
88 To enable this, use the option
92 keep a database containing the Message-ID's of incoming messages,
93 in order to detect duplicates. Depending on your configuration,
94 this database will be in either ndbm or Berkeley db format.
98 switch may be used to pass an arbitrary argument to
101 may invoke on your behalf.
107 to give information on
108 stdout about its progress. The
111 verbose debugging output on stderr. These flags are useful when
112 creating and debugging your
113 .RI \*(lq \&.maildelivery \*(rq
115 allow you to see the decisions and actions that
117 is taking, as well as check for syntax errors in your
118 .RI \*(lq \&.maildelivery \*(rq
121 .SS "Message Transfer Agents"
122 Most modern MTAs including
127 support a \&.forward file for directing incoming mail.
128 You should include the line
131 \*(lq|\ %libdir%/slocal\ \-user\ username\*(rq
134 in your \&.forward file in your home directory. This will cause
137 on your behalf when a message arrives.
139 .SS "The Maildelivery File"
141 .RI \*(lq \&.maildelivery \*(rq
145 incoming mail. Each line of this file consists of five fields, separated
146 by white-space or comma. Since double-quotes are honored, these
147 characters may be included in a single argument by enclosing the entire
148 argument in double-quotes. A double-quote can be included by preceding it
149 with a backslash. Lines beginning with `#' and blank lines are ignored.
151 The format of each line in the
152 .RI \*(lq \&.maildelivery \*(rq
156 .B header pattern action result string
161 The name of a header field (such as To, Cc, or From) that is to
162 be searched for a pattern. This is any field in the headers of
163 the message that might be present.
165 The following special fields are also defined:
168 the out-of-band sender information
171 the address that was used to cause delivery to the recipient
176 if the message hasn't been delivered yet
184 The sequence of characters to match in the specified header field.
185 Matching is case-insensitive, but does not use regular expressions.
190 The action to take to deliver the message. When a message is delivered,
191 a \*(lqDelivery\-Date:\ date\*(rq header is added which indicates the date
192 and time that message was delivered.
195 This action always succeeds.
197 .IR file ", " mbox ", or " >
198 Append the message to the file named by
201 appended to the file in mbox (uucp) format. This is the format used by most
202 other mail clients (such as mailx, elm). If the message can be appended to
203 the file, then this action succeeds.
206 Pipe the message as the standard input to the command named by
208 using the Bourne shell
210 to interpret the string.
211 Prior to giving the string to the shell, it is expanded with the following
214 .TP \w'zzreplyztozaaa'u
216 the out-of-band sender information
217 .TP \w'zzreplyztozaaa'u
219 the address that was used to cause delivery to the recipient
220 .TP \w'zzreplyztozaaa'u
222 the size of the message in bytes
223 .TP \w'zzreplyztozaaa'u
225 either the \*(lqReply\-To:\*(rq or \*(lqFrom:\*(rq field of the message
226 .TP \w'zzreplyztozaaa'u
228 the out-of-band information specified
234 but executes the command
235 directly, after built-in variable expansion, without assistance from
236 the shell. This action can be used to avoid quoting special characters
237 which your shell might interpret.
240 Store the message in the
244 Currently this is handled by piping the message to the
248 although this may change in the future.
253 Indicates how the action should be performed:
256 Perform the action. If the action succeeds, then the message
257 is considered delivered.
260 Perform the action. Regardless of the outcome of the action,
261 the message is not considered delivered.
264 Perform the action only if the message has not been delivered.
265 If the action succeeds, then the message is considered delivered.
268 Perform the action only if the message has not been delivered
269 and the previous action succeeded. If this action succeeds, then the
270 message is considered delivered.
272 The delivery file is always read completely, so that several matches
273 can be made and several actions can be taken.
276 .SS "Security of Delivery Files"
277 In order to prevent security problems, the
278 .RI \*(lq \&.maildelivery \*(rq
279 file must be owned either by the user or by root, and must be
280 writable only by the owner. If this is not the case, the file is
284 .RI \*(lq \&.maildelivery \*(rq
285 file cannot be found, or does not
286 perform an action which delivers the message, then
288 will check for a global delivery file at
289 .IR %etcdir%/maildelivery .
290 This file is read according to the same rules. This file must be
291 owned by the root and must be writable only by the root.
293 If a global delivery file cannot be found or does not perform an
294 action which delivers the message, then standard delivery to the
295 user's maildrop is performed.
297 .SS "Example Delivery File"
298 To summarize, here's an example delivery file:
301 .ta \w'default 'u +\w'mh-workersxx 'uC +\w'destroy 'uC +\w'result 'u
303 # .maildelivery file for nmh's slocal
305 # Blank lines and lines beginning with a '#' are ignored
307 # FIELD PATTERN ACTION RESULT STRING
310 # File mail with foobar in the \*(lqTo:\*(rq line into file foobar.log
311 To foobar file A foobar.log
313 # Pipe messages from coleman to the program message-archive
314 From coleman pipe A /bin/message-archive
316 # Anything to the \*(lqnmh-workers\*(rq mailing list is put in
317 # its own folder, if not filed already
318 To nmh-workers folder ? nmh-workers
320 # Anything with Unix in the subject is put into
322 Subject unix file A unix-mail
324 # I don't want to read mail from Steve, so destroy it
325 From steve destroy A \-
327 # Put anything not matched yet into mailbox
328 default \- file ? mailbox
331 * \- pipe R %libdir%/rcvtty
334 .SS "Sub-process environment"
335 When a process is invoked, its environment is: the user/group-ids are
336 set to recipient's ids; the working directory is the recipient's home
337 directory; the umask is 0077; the process has no /dev/tty; the standard
338 input is set to the message; the standard output and diagnostic output are
339 set to /dev/null; all other file-descriptors are closed; the environment
344 are set appropriately, and no other environment variables exist.
346 The process is given a certain amount of time to execute. If the process
347 does not exit within this limit, the process will be terminated with
348 extreme prejudice. The amount of time is calculated as ((size / 60) +
349 300) seconds, where size is the number of bytes in the message (with
350 30 minutes the maximum time allowed).
352 The exit status of the process is consulted in determining the success
353 of the action. An exit status of zero means that the action succeeded.
354 Any other exit status (or abnormal termination) means that the action
357 In order to avoid any time limitations, you might implement a process
360 The parent would return the appropriate
361 value immediately, and the child could continue on, doing whatever it
362 wanted for as long as it wanted. This approach is somewhat risky if
363 the parent is going to return an exit status of zero. If the parent is
364 going to return a non-zero exit status, then this approach can lead to
365 quicker delivery into your maildrop.
370 .ta \w'%etcdir%/ExtraBigFileName 'u
371 ^%etcdir%/mts.conf~^nmh mts configuration file
372 ^$HOME/\&.maildelivery~^The file controlling local delivery
373 ^%etcdir%/maildelivery~^Rather than the standard file
374 ^%mailspool%/$USER~^The default maildrop
378 rcvdist(1), rcvpack(1), rcvstore(1), rcvtty(1), mh\-format(5)
383 .RB ` \-nosuppressdup '
384 .RB ` \-maildelivery "' defaults to $HOME/\&.maildelivery"
385 .RB ` \-mailbox "' deaults to %mailspool%/$USER"
386 .RB ` \-file "' defaults to stdin"
387 .RB ` \-user "' defaults to the current user"
395 was originally designed to be backward-compatible with
401 .RI \*(lq \&.maildelivery \*(rq
402 file syntax is somewhat limited. But
404 has been modified and extended, so that is it no longer compatible with
407 In addition to an exit status of zero, the
413 (9) mean that the message has been fully delivered.
414 Any other non-zero exit status, including abnormal termination, is
420 \*(lquse an alternate route\*(rq (deliver the message to the maildrop).
423 Only two return codes are meaningful, others should be.
426 was originally designed to be backwards-compatible with the
428 functionality provided by