5 .TH SLOCAL %manext1% "%nmhdate%" MH.6.8 [%nmhversion%]
7 slocal \- asynchronously filter and deliver new mail
12 [address\ info\ sender]
23 .\" \%[\-home\ homedir]
28 .RB [ \-verbose " | " \-noverbose ]
29 .RB [ \-suppressdup " | " \-nosuppressdup ]
36 is a program designed to allow you to have your inbound
37 mail processed according to a complex set of selection criteria.
38 You do not normally invoke
42 is invoked on your behalf by your system's Message Transfer Agent
45 when the message arrives.
47 The message selection criteria used by
48 .B slocal is specified
50 .RI \*(lq \&.maildelivery \*(rq
51 in the user's home directory.
52 You can specify an alternate file with the
55 option. The syntax of this file is specified below.
57 The message delivery address and message sender are determined from
58 the Message Transfer Agent envelope information, if possible.
61 the sender will obtained from the UUCP
62 \*(lqFrom:\*(rq line, if present. The user may override these
63 values with command line arguments, or arguments to the
69 The message is normally read from the standard input. The
71 switch sets the name of the file from which the message should be
72 read, instead of reading stdin. This is useful when debugging a
73 .RI \*(lq \&.maildelivery \*(rq
80 the name of the user for
81 whom it is delivering mail. The
85 the name of the user's maildrop file.
88 is able to detect and suppress duplicate messages.
89 To enable this, use the option
93 keep a database containing the Message-ID's of incoming messages,
94 in order to detect duplicates. Depending on your configuration,
95 this database will be in either ndbm or Berkeley db format.
99 switch may be used to pass an arbitrary argument to
102 may invoke on your behalf.
108 to give information on
109 stdout about its progress. The
112 verbose debugging output on stderr. These flags are useful when
113 creating and debugging your
114 .RI \*(lq \&.maildelivery \*(rq
116 allow you to see the decisions and actions that
118 is taking, as well as check for syntax errors in your
119 .RI \*(lq \&.maildelivery \*(rq
122 .SS "Message Transfer Agents"
125 you should include the line
128 \*(lq|\ %libdir%/slocal\ \-user\ username\*(rq
131 in your \&.forward file in your home directory. This will cause
135 on your behalf when a message arrives.
139 you should (symbolically) link
143 in your home directory. This will
148 on your behalf with the correct
149 .RI \*(lq "address\ info\ sender" \*(rq
154 then you should not use
156 An equivalent functionality is already provided by
162 .SS "The Maildelivery File"
164 .RI \*(lq \&.maildelivery \*(rq
168 incoming mail. Each line of this file consists of five fields, separated
169 by white-space or comma. Since double-quotes are honored, these
170 characters may be included in a single argument by enclosing the entire
171 argument in double-quotes. A double-quote can be included by preceding it
172 with a backslash. Lines beginning with `#' and blank lines are ignored.
174 The format of each line in the
175 .RI \*(lq \&.maildelivery \*(rq
179 .B header pattern action result string
184 The name of a header field (such as To, Cc, or From) that is to
185 be searched for a pattern. This is any field in the headers of
186 the message that might be present.
188 The following special fields are also defined:
191 the out-of-band sender information
194 the address that was used to cause delivery to the recipient
199 if the message hasn't been delivered yet
207 The sequence of characters to match in the specified header field.
208 Matching is case-insensitive, but does not use regular expressions.
213 The action to take to deliver the message. When a message is delivered,
214 a \*(lqDelivery\-Date:\ date\*(rq header is added which indicates the date
215 and time that message was delivered.
216 .TP \w'qpipezorztzzz'u
218 This action always succeeds.
219 .IR file ", " mbox ", or " >
220 Append the message to the file named by
223 appended to the file in mbox (uucp) format. This is the format used by most
224 other mail clients (such as mailx, elm). If the message can be appended to
225 the file, then this action succeeds.
226 .TP \w'qpipezorztzzz'u
230 but always appends the message using the MMDF mailbox format.
231 .TP \w'qpipezorztzzz'u
233 Pipe the message as the standard input to the command named by
235 using the Bourne shell
237 to interpret the string.
238 Prior to giving the string to the shell, it is expanded with the following
240 .RS \w'qpipezorztzzz'u
241 .TP \w'zzreplyztozaaa'u
243 the out-of-band sender information
244 .TP \w'zzreplyztozaaa'u
246 the address that was used to cause delivery to the recipient
247 .TP \w'zzreplyztozaaa'u
249 the size of the message in bytes
250 .TP \w'zzreplyztozaaa'u
252 either the \*(lqReply\-To:\*(rq or \*(lqFrom:\*(rq field of the message
253 .TP \w'zzreplyztozaaa'u
255 the out-of-band information specified
258 .TP \w'qpipezorztzzz'u
262 but executes the command
263 directly, after built-in variable expansion, without assistance from
264 the shell. This action can be used to avoid quoting special characters
265 which your shell might interpret.
266 .TP \w'qpipezorztzzz'u
268 Store the message in the
272 Currently this is handled by piping the message to the
276 although this may change in the future.
281 Indicates how the action should be performed:
284 Perform the action. If the action succeeds, then the message
285 is considered delivered.
288 Perform the action. Regardless of the outcome of the action,
289 the message is not considered delivered.
292 Perform the action only if the message has not been delivered.
293 If the action succeeds, then the message is considered delivered.
296 Perform the action only if the message has not been delivered
297 and the previous action succeeded. If this action succeeds, then the
298 message is considered delivered.
300 The delivery file is always read completely, so that several matches
301 can be made and several actions can be taken.
304 .SS "Security of Delivery Files"
305 In order to prevent security problems, the
306 .RI \*(lq \&.maildelivery \*(rq
307 file must be owned either by the user or by root, and must be
308 writable only by the owner. If this is not the case, the file is
312 .RI \*(lq \&.maildelivery \*(rq
313 file cannot be found, or does not
314 perform an action which delivers the message, then
316 will check for a global delivery file at
317 .IR %etcdir%/maildelivery .
318 This file is read according to the same rules. This file must be
319 owned by the root and must be writable only by the root.
321 If a global delivery file cannot be found or does not perform an
322 action which delivers the message, then standard delivery to the
323 user's maildrop is performed.
325 .SS "Example Delivery File"
326 To summarize, here's an example delivery file:
329 .ta \w'default 'u +\w'mh-workersxx 'uC +\w'destroy 'uC +\w'result 'u
331 # .maildelivery file for nmh's slocal
333 # Blank lines and lines beginning with a '#' are ignored
335 # FIELD PATTERN ACTION RESULT STRING
338 # File mail with foobar in the \*(lqTo:\*(rq line into file foobar.log
339 To foobar file A foobar.log
341 # Pipe messages from coleman to the program message-archive
342 From coleman pipe A /bin/message-archive
344 # Anything to the \*(lqnmh-workers\*(rq mailing list is put in
345 # its own folder, if not filed already
346 To nmh-workers folder ? nmh-workers
348 # Anything with Unix in the subject is put into
350 Subject unix file A unix-mail
352 # I don't want to read mail from Steve, so destroy it
353 From steve destroy A \-
355 # Put anything not matched yet into mailbox
356 default \- file ? mailbox
359 * \- pipe R %libdir%/rcvtty
362 .SS "Sub-process environment"
363 When a process is invoked, its environment is: the user/group-ids are
364 set to recipient's ids; the working directory is the recipient's home
365 directory; the umask is 0077; the process has no /dev/tty; the standard
366 input is set to the message; the standard output and diagnostic output are
367 set to /dev/null; all other file-descriptors are closed; the environment
372 are set appropriately, and no other environment variables exist.
374 The process is given a certain amount of time to execute. If the process
375 does not exit within this limit, the process will be terminated with
376 extreme prejudice. The amount of time is calculated as ((size / 60) +
377 300) seconds, where size is the number of bytes in the message (with
378 30 minutes the maximum time allowed).
380 The exit status of the process is consulted in determining the success
381 of the action. An exit status of zero means that the action succeeded.
382 Any other exit status (or abnormal termination) means that the action
385 In order to avoid any time limitations, you might implement a process
388 The parent would return the appropriate
389 value immediately, and the child could continue on, doing whatever it
390 wanted for as long as it wanted. This approach is somewhat risky if
391 the parent is going to return an exit status of zero. If the parent is
392 going to return a non-zero exit status, then this approach can lead to
393 quicker delivery into your maildrop.
398 .ta \w'%etcdir%/ExtraBigFileName 'u
399 ^%etcdir%/mts.conf~^nmh mts configuration file
400 ^$HOME/\&.maildelivery~^The file controlling local delivery
401 ^%etcdir%/maildelivery~^Rather than the standard file
402 ^%mailspool%/$USER~^The default maildrop
406 rcvdist(1), rcvpack(1), rcvstore(1), rcvtty(1), mh\-format(5)
411 .RB ` \-nosuppressdup '
412 .RB ` \-maildelivery "' defaults to $HOME/\&.maildelivery"
413 .RB ` \-mailbox "' deaults to %mailspool%/$USER"
414 .RB ` \-file "' defaults to stdin"
415 .RB ` \-user "' defaults to the current user"
423 was originally designed to be backward-compatible with
429 .RI \*(lq \&.maildelivery \*(rq
430 file syntax is somewhat limited. But
432 has been modified and extended, so that is it no longer compatible with
435 In addition to an exit status of zero, the
441 (9) mean that the message has been fully delivered.
442 Any other non-zero exit status, including abnormal termination, is
448 \*(lquse an alternate route\*(rq (deliver the message to the maildrop).
451 Only two return codes are meaningful, others should be.
454 was originally designed to be backwards-compatible with the
456 functionality provided by