source: trunk/third/nmh/man/slocal.man @ 12455

Revision 12455, 11.7 KB checked in by danw, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r12454, which included commits to RCS files with non-trunk default branches.
Line 
1.\"
2.\" %nmhwarning%
3.\" $Id: slocal.man,v 1.1.1.1 1999-02-07 18:14:22 danw Exp $
4.\"
5.\" include the -mh macro file
6.so %etcdir%/tmac.h
7.\"
8.TH SLOCAL %manext1% MH.6.8 [%nmhversion%]
9.SH NAME
10slocal \- asynchronously filter and deliver new mail
11.SH SYNOPSIS
12.in +.5i
13.ti -.5i
14%libdir%/slocal \%[address\ info\ sender]
15.na
16.br
17\%[\-addr\ address]
18\%[\-info\ data]
19\%[\-sender\ sender]
20.br
21\%[\-user\ username]
22\%[\-mailbox\ mbox]
23.\" \%[\-home\ homedir]
24\%[\-file\ file]
25.br
26\%[\-maildelivery\ deliveryfile]
27\%[\-verbose] \%[\-noverbose]
28.br
29\%[\-suppressdup] \%[\-nosuppressdup]
30\%[\-debug]
31.br
32\%[\-version]
33\%[\-help]
34.ad
35.in -.5i
36.SH DESCRIPTION
37\fISlocal\fP is a program designed to allow you to have your inbound
38mail processed according to a complex set of selection criteria.
39You do not normally invoke \fIslocal\fP yourself, rather \fIslocal\fP
40is invoked on your behalf by your system's Message Transfer Agent
41(such as sendmail) when the message arrives.
42
43The message selection criteria used by \fIslocal\fP is specified
44in the file \fI\&.maildelivery\fP in the user's home directory.
45You can specify an alternate file with the `\-maildelivery file'
46option.  The syntax of this file is specified below.
47
48The message delivery address and message sender are determined from
49the Message Transfer Agent envelope information, if possible.
50Under \fIsendmail\fP, the sender will obtained from the UUCP
51\*(lqFrom\ \*(rq line, if present.  The user may override these
52values with command line arguments, or arguments to the `\-addr'
53and `\-sender' switches.
54
55The message is normally read from the standard input.  The `\-file'
56switch sets the name of the file from which the message should be
57read, instead of reading stdin.  This is useful when debugging a
58\fI\&.maildelivery\fP file.
59
60The `\-user' switch tells \fIslocal\fP the name of the user for
61whom it is delivering mail.  The `\-mailbox' switch tells \fIslocal\fP
62the name of the user's maildrop file.
63
64\fIslocal\fR is able to detect and suppress duplicate messages.
65To enable this, use the option `\-suppressdup'.   \fIslocal\fR will
66keep a database containing the Message-ID's of incoming messages,
67in order to detect duplicates.  Depending on your configuration,
68this database will be in either ndbm or Berkeley db format.
69
70The `\-info' switch may be used to pass an arbitrary argument to
71sub-processes which \fIslocal\fP may invoke on your behalf.
72
73The `\-verbose' switch causes \fIslocal\fP to give information on
74stdout about its progress.  The `\-debug' switch produces more
75verbose debugging output on stderr.  These flags are useful when
76creating and debugging your \fI\&.maildelivery\fP file, as they
77allow you to see the decisions and actions that \fIslocal\fR is
78taking, as well as check for syntax errors in your \fI\&.maildelivery\fP
79file.
80
81.Uh "Message Transfer Agents"
82If your MTA is \fIsendmail\fP, you should include the line
83.sp
84.nf
85.in +.5i
86    \*(lq|\ %libdir%/slocal\ \-user\ username\*(rq
87.in -.5i
88.fi
89.sp
90in your \&.forward file in your home directory.  This will cause
91\fIsendmail\fP to invoke \fIslocal\fP on your behalf when a
92message arrives.
93
94If your MTA is \fIMMDF-I\fP, you should (symbolically) link
95%libdir%/slocal to the file bin/rcvmail in your home directory.  This will
96cause \fIMMDF-I\fP to invoke \fIslocal\fP on your behalf with the correct
97\*(lq\fIaddress\ info\ sender\fP\*(rq arguments.
98
99If your MTA is \fIMMDF-II\fP, then you should not use \fIslocal\fP.
100An equivalent functionality is already provided by \fIMMDF-II\fP; see
101maildelivery(5) for details.
102
103.Uh "The Maildelivery File"
104
105The \fI\&.maildelivery\fR file controls how slocal filters and delivers
106incoming mail.  Each line of this file consists of five fields, separated
107by white-space or comma.  Since double-quotes are honored, these
108characters may be included in a single argument by enclosing the entire
109argument in double-quotes.  A double-quote can be included by preceding it
110with a backslash.  Lines beginning with `#' and blank lines are ignored.
111
112The format of each line in the \fI\&.maildelivery\fR file is:
113
114        \fBheader       pattern action  result  string\fR
115.sp
116.in +.5i
117.ti -.5i
118\fBheader\fP:
119.br
120The name of a header field (such as To, Cc,  or From) that is to
121be searched for a pattern.  This is any field in the headers of
122the message that might be present.
123
124The following special fields are also defined:
125.sp
126.in +1i
127.ta +1i
128.ti -1i
129\fIsource\fR    the out-of-band sender information
130.ti -1i
131\fIaddr\fR      the address that was used to cause delivery to the recipient
132.ti -1i
133\fIdefault\fR   this matches \fIonly\fR if the message hasn't been delivered yet
134.ti -1i
135\fI*\fR this always matches
136.in -1i
137
138.ti -.5i
139\fBpattern\fR:
140.br
141The sequence of characters to match in the specified header field.
142Matching is case-insensitive, but does not use regular expressions.
143
144.ti -.5i
145\fBaction\fR:
146.br
147The action to take to deliver the message.  When a message is delivered,
148a \*(lqDelivery\-Date:\ date\*(rq header is added which indicates the date
149and time that message was delivered.
150.sp
151.in +1i
152.ta +1i
153.ti -1i
154\fIdestroy\fR
155This action always succeeds.
156
157.ti -1i
158\fIfile\fR, \fImbox\fR, or >
159Append the message to the file named by \fBstring\fR.  The message is
160appended to the file in mbox (uucp) format.  This is the format used by most
161other mail clients (such as mailx, elm).  If the message can be appended to
162the file, then this action succeeds.
163
164.ti -1i
165\fImmdf\fR      Identical to \fIfile\fR, but always appends the message using
166the MMDF mailbox format.
167
168.ti -1i
169\fIpipe\fR or |
170Pipe the message as the standard input to the command named by
171\fBstring\fR, using the Bourne shell \fIsh\fR(1) to interpret the string.
172Prior to giving the string to the shell, it is expanded with the following
173built-in variables:
174.sp
175.in +1i
176.ta +1i
177.ti -1i
178$(sender)       the out-of-band sender information
179.ti -1i
180$(address)      the address that was used to cause delivery to the recipient
181.ti -1i
182$(size) the size of the message in bytes
183.ti -1i
184$(reply\-to)    either the \*(lqReply\-To:\*(rq or \*(lqFrom:\*(rq field
185of the message
186.ti -1i
187$(info) the out-of-band information specified
188.in -1i
189
190.ti -1i
191\fIqpipe\fR or <caret> Similar to \fIpipe\fR, but executes the command
192directly, after built-in variable expansion, without assistance from
193the shell.  This action can be used to avoid quoting special characters
194which your shell might interpret.
195
196.ti -1i
197\fIfolder\fR or \fI\+\fR        Store the message in the nmh folder named
198by \fBstring\fR.  Currently his is handled by piping the message to the nmh
199program `rcvstore', although this may change in the future.
200
201.in -1i
202.ti -.5i
203\fBresult\fR:
204.br
205Indicates how the action should be performed:
206
207.in +1i
208.ta +1i
209.ti -1i
210\fIA\fR Perform the action.  If the action succeeds, then the message
211is considered delivered.
212
213.ti -1i
214\fIR\fR Perform the action.
215Regardless of the outcome of the action, the message is not considered
216delivered.
217
218.ti -1i
219\fI?\fR Perform the action only if the message has not been delivered.
220If the action succeeds, then the message is considered delivered.
221
222.ti -1i
223\fIN\fR Perform the action only if the message has not been delivered
224and the previous action succeeded.  If this action succeeds, then the
225message is considered delivered.
226.sp
227.in -1i
228.in -.5i
229
230The delivery file is always read completely, so that several matches
231can be made and several actions can be taken.
232.fi
233
234.Uh "Security of Delivery Files"
235In order to prevent security problems, the \fI\&.maildelivery\fR
236file must be owned either by the user or by root, and must be
237writable only by the owner.  If this is not the case, the file is
238not read.
239
240If the \fI\&.maildelivery\fR file cannot be found, or does not
241perform an action which delivers the message, then \fIslocal\fP
242will check for a global delivery file at %etcdir%/maildelivery.
243This file is read according to the same rules.  This file must be
244owned by the root and must be writable only by the root.
245
246If a global delivery file cannot be found or does not perform an
247action which delivers the message, then standard delivery to the
248user's maildrop is performed.
249.fi
250
251.Uh "Example Delivery File"
252To summarize, here's an example delivery file:
253.sp
254.if t .in +.5i
255.nf
256.ta \w'default  'u +\w'mh-workersxx 'uC +\w'destroy 'uC +\w'result 'u
257#
258# .maildelivery file for nmh's slocal
259#
260# Blank lines and lines beginning with a '#' are ignored
261#
262# FIELD   PATTERN   ACTION  RESULT  STRING
263#
264
265# File mail with foobar in the \*(lqTo:\*(rq line into file foobar.log
266To        foobar    file    A       foobar.log
267
268# Pipe messages from coleman to the program message-archive
269From      coleman   pipe    A       /bin/message-archive
270
271# Anything to the \*(lqnmh-workers\*(rq mailing list is put in
272# its own folder, if not filed already
273To        nmh-workers  folder ?     nmh-workers
274
275# Anything with Unix in the subject is put into
276# the file unix-mail
277Subject   unix      file    A       unix-mail
278
279# I don't want to read mail from Steve, so destroy it
280From      steve     destroy A       \-
281
282# Put anything not matched yet into mailbox
283default   \-        file    ?       mailbox
284
285# always run rcvtty
286*         \-        pipe    R       /nmh/lib/rcvtty
287.re
288.fi
289
290.Uh "Sub-process environment"
291When a process is invoked, its environment is: the user/group-ids are
292set to recipient's ids; the working directory is the recipient's home
293directory; the umask is 0077; the process has no /dev/tty; the standard
294input is set to the message; the standard output and diagnostic output are
295set to /dev/null; all other file-descriptors are closed; the environment
296variables \fB$USER\fR, \fB$HOME\fR, \fB$SHELL\fR are set appropriately,
297and no other environment variables exist.
298
299The process is given a certain amount of time to execute.  If the process
300does not exit within this limit, the process will be terminated with
301extreme prejudice.  The amount of time is calculated as ((size / 60) +
302300) seconds, where size is the number of bytes in the message (with
30330 minutes the maximum time allowed).
304
305The exit status of the process is consulted in determining the success
306of the action.  An exit status of zero means that the action succeeded.
307Any other exit status (or abnormal termination) means that the action
308failed.
309
310In order to avoid any time limitations, you might implement a process
311that began by \fIforking\fR.  The parent would return the appropriate
312value immediately, and the child could continue on, doing whatever it
313wanted for as long as it wanted.  This approach is somewhat risky if
314the parent is going to return an exit status of zero.  If the parent is
315going to return a non-zero exit status, then this approach can lead to
316quicker delivery into your maildrop.
317.Fi
318^%etcdir%/mts.conf~^nmh mts configuration file
319^$HOME/\&.maildelivery~^The file controlling local delivery
320^%etcdir%/maildelivery~^Rather than the standard file
321^%mailspool%/$USER~^The default maildrop
322.Sa
323rcvdist(1), rcvpack(1), rcvstore(1), rcvtty(1), mh\-format(5)
324.De
325`\-noverbose'
326.Ds
327`\-nosuppressdup'
328.Ds
329`\-maildelivery \&.maildelivery'
330.Ds
331`\-mailbox %mailspool%/$USER'
332.Ds
333`\-file' defaults to stdin
334.Ds
335`\-user' defaults to the current user
336.Co
337None
338.Hi
339\fISlocal\fP was originally designed to be backward-compatible with
340the \fImaildelivery\fP facility provided by \fIMMDF-II\fP.  Thus, the
341\fI\&.maildelivery\fP file syntax is somewhat limited.  But \fIslocal\fP
342has been modified and extended, so that is it no longer compatible with
343\fIMMDF-II\fP.
344
345In addition to an exit status of zero, the \fIMMDF\fR values \fIRP_MOK\fR
346(32) and \fIRP_OK\fR (9) mean that the message has been fully delivered.
347Any other non-zero exit status, including abnormal termination, is
348interpreted as the \fIMMDF\fR value \fIRP_MECH\fR (200), which means
349\*(lquse an alternate route\*(rq (deliver the message to the maildrop).
350.Bu
351Only two return codes are meaningful, others should be.
352
353\fISlocal\fP was originally designed to be backwards-compatible with the
354\fImaildelivery\fP functionality provided by \fBMMDF-II\fP.
Note: See TracBrowser for help on using the repository browser.