Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / conf / doc / RCS / maildelivery.5,v
1 head    1.2;
2 access;
3 symbols;
4 locks; strict;
5 comment @# @;
6
7
8 1.2
9 date    92.10.26.17.02.08;      author jromine; state Exp;
10 branches;
11 next    1.1;
12
13 1.1
14 date    92.10.26.17.01.26;      author jromine; state Exp;
15 branches;
16 next    ;
17
18
19 desc
20 @@
21
22
23 1.2
24 log
25 @fixes from Jerry Peek.  These should probably be sent to bug-mmdf as well.
26 @
27 text
28 @.tr ~
29 .de NP
30 .IP "\fI\\$1\fP" 10
31 ..
32 .de II
33 .nr P- \\n()P    \" save the preceeding IP space
34 .nr )P 0        \" now set it to 0
35 .NP "\\$1\fP"
36 .nr )P \\n(P-    \" restore the preceeding IP space
37 ..
38 .ds M \fI.maildelivery\fP
39 .TH MAILDELIVERY 5 "1 October, 1985"
40 .SH NAME
41 maildelivery
42 .SH SYNOPSIS
43 User delivery specification file
44 .SH DESCRIPTION
45 The delivery of mail by the local channel can run through various
46 courses, including using a user tailorable file.
47 The delivery follows the following strategy, giving up at any point
48 it considers the message delivered.
49 .RS
50 .IP "1)" 4
51 If the address indicates a pipe or file default
52 then that is carried out.
53 .IP "2)" 4
54 The file \*M
55 (or something similar) in the home directory is read if it exists
56 and the actions in it are followed.
57 .IP "3)" 4
58 A system-wide file is consulted next, such as
59 .I /usr/lib/maildelivery
60 and the actions are similar to 2.
61 .IP "4)" 4
62 If the message still hasn't been delivered, then it is put into
63 the user's normal mailbox 
64 .RI ( .mail
65 or
66 .IR mailbox )
67 depending on the system.
68 .RE
69 .PP
70 The format of the \*M file is
71 .RS
72 .B field
73 .I <FS>
74 .B pattern
75 .I <FS>
76 .B action
77 .I <FS>\r
78 .B result
79 .I <FS>
80 .B string
81 .RE
82 where
83 .br
84 .NP field
85 is name of a field that is to be searched for a pattern.
86 This is any header field that you might find in a message.
87 The most commonly used headers are usually
88 From, to, cc, subject and sender.
89 As well as the standard headers, there are some psuedo-headers
90 that are can also be used. These are :-
91 .RS
92 .II source
93 The out of band sender information. This is the address MMDF would
94 use for reporting delivery problems with the message.
95 .II addr
96 the address that was used to mail to you, normally 'yourname' or 
97 \&'yourname=string' (see below).
98 .II default
99 if the message hasn't been delivered yet, this field is matched.
100 .II *
101 this case is always true regardless of any other action.
102 .RE
103 .NP pattern
104 is some sequence of characters that may be matched in the
105 above
106 .IR field .
107 Case is not significant.
108 .IP \fIaction\fP 10
109 is one of the mail delivery actions supported by the
110 local channel.  Currently the supported actions are
111 .B file
112 or
113 .BR > ,
114 which
115 appends the message to the given file, with delimiters;
116 .B pipe
117 or
118 .BR | ,
119 which starts up a process with the message
120 as the standard input;
121 and
122 .B destroy
123 which throws the message away.
124 There is also
125 .B qpipe
126 or
127 .BR ^ ,
128 which fakes a pipe command and is quicker than the standard pipe,
129 but does not do header reformatting.
130 .br
131 For piped commands, the exit status of the command is significant.
132 An exit status of 0 implies that the command succeeded and everything
133 went well. An exit status of octal 0300-0377 indicates that a permanent
134 failure occured and the message should be rejected; these error codes
135 are given in mmdf.h. Any other exit
136 status indicates a temporary failure and the delivery attempt will
137 be aborted and restarted at a later time.
138 .NP result
139 is one of the letters A, R or ? which stand for
140 Accept, Reject and "Accept if not delivered yet".
141 They have the following effects:
142 .RS
143 .II A
144 If the result of this line's action is OK, then the message can be
145 considered delivered.
146 .II R
147 The message is not to be considered delivered by this action.
148 .II ?
149 This is equivalent to
150 .I A
151 except that the action is not carried
152 out if the message has already been accepted.
153 .RE
154 .PP
155 The file is always read completely so that several matches
156 can be made, and several actions taken.
157 As a security check, the \*M file must be owned by either
158 the user or root, and must not have group or general
159 write permission. In addition the system delivery file has the above
160 restrictions but must also be owned by root.
161 If the field specified does not need a pattern a dash (\-)
162 or similar symbol is usually inserted to show that the field is present
163 but not used.
164 The field separator character can be either a tab, space or comma (,).
165 These characters can be included in a string by quoting them with
166 double quotes (") (double quotes can be included with a backslash '\e').
167 .PP
168 MMDF treats local addresses which contain an equals sign ('=')
169 in a special manner.  Everything in a local address
170 from an equals sign to the '@@' is ignored and passed on to the
171 local channel.  The local channel will make the entire string available
172 for matching against the
173 .I addr
174 string of the \*M file.
175 For example, if you were to
176 subscribe to a digest as "foo=digest@@bar.NET",
177 .B submit
178 and the local channel will verify
179 that it is legal to deliver
180 to "foo", but then the entire string "foo=digest" will be available
181 for string matching against the \*M file for the
182 .B addr
183 field.
184 .SH ENVIRONMENT
185 The environment in which piped programs are run
186 contains a few standard features, specifically:
187 .ne 5
188 .sp
189 .nf
190 HOME is set to the user's home directory.
191 USER is set to the user's login name.
192 SHELL is set to the user's login shell (defaults to /bin/sh).
193 .sp
194 .fi
195 The default umask is set up to 077, this gives a very protective
196 creation mask.
197 Initgroups is called if the 4.2 version of UNIX is running.
198 If further requirements are needed, then a shell script
199 can be run first to set up more complex environments.
200 .PP
201 There are certain built-in variables that you can give to
202 a piped program.  These are
203 .IR $(sender) ,
204 .IR $(address) ,
205 .IR $(size) ,
206 .I $(reply-to)
207 and
208 .IR $(info) .
209 .I $(sender)
210 is set to the return address for the message.
211 .I $(address)
212 is set to the address that was used to mail to you, normally `yourname'
213 or `yourname=string'.
214 .I $(size)
215 is set to the size in bytes of this message.
216 .I $(reply-to)
217 is set to the Reply-To: field (or the From: field if the former is
218 missing) and so can be used for automatic replies.
219 .I $(info)
220 is the info field from the internal mail header and is probably only
221 of interest to the system maintainers.
222 .SH EXAMPLE
223 .PP
224 Here is a rough idea of what a \*M file looks like:
225 .ne 12
226 .nf
227 .sp
228 # lines \fIstarting\fP with a '#' are ignored.
229 # as are blank lines
230 # file mail with mmdf2 in the "To:" line into file mmdf2.log
231 To~~~~mmdf2~~~~file~~~~A~~~~mmdf2.log
232 # Messages from mmdf pipe to the program err-message-archive
233 From~~~~mmdf~~~~pipe~~~~A~~~~err-message-archive
234 # Anything with the "Sender:" address "uk-mmdf-workers"
235 # file in mmdf2.log if not filed already
236 Sender~~~~uk-mmdf-workers~~~~file~~~~?~~~~mmdf2.log
237 # "To:" unix \- put in file unix-news
238 To~~~~Unix~~~~>~~~~A~~~~unix-news
239 # if the address is jpo=mmdf \- pipe into mmdf-redist
240 Addr~~~~jpo=mmdf~~~~|~~~~A~~~~mmdf-redist
241 # if the address is jpo=ack \- send an acknowledgement copy back
242 Addr~~~~jpo=ack~~~~|~~~~R~~~~"resend~~\-r~~$(reply-to)"
243 # anything from steve \- destroy!
244 from~~~~steve~~~~destroy~~~~A~~~~\-
245 # anything not matched yet \- put into mailbox
246 default~~~~\-~~~~>~~~~?~~~~mailbox
247 # always run rcvalert
248 *~~~~\-~~~~|~~~~R~~~~rcvalert
249 .sp
250 .fi
251 .SH FILES
252 $HOME/.maildelivery
253 \- the file's normal location.
254 .br
255 /usr/lib/maildelivery \-
256 the system file. This should be protected against attack.  It
257 may contain contents such as:
258 .ne 4
259 .sp
260 .nf
261 default~~~~\-~~~~pipe~~~~A~~~~stdreceive
262 *~~~~\-~~~~|~~~~R~~~~ttynotify
263 .fi
264 .sp
265 This allows interfacing to non-standard mail systems,
266 ones that don't believe in delimiter-separated mailboxes.
267 .SH "SEE ALSO"
268 rcvtrip(1)
269 .SH BUGS
270 And why not?
271 @
272
273
274 1.1
275 log
276 @Initial revision
277 @
278 text
279 @d70 1
280 a70 1
281 'yourname=string' (see below).
282 d107 1
283 a107 1
284 failure occured and the message should be rejected, these error codes
285 d170 1
286 a170 1
287 Initgroups is called if 4.2 version of UNIX is running.
288 d215 1
289 a215 1
290 Addr~~~~jpo=ack~~~~|~~~~R~~~~resend~~\-r~~$(reply-to)
291 d226 1
292 a226 1
293 \- the files normal location.
294 d238 2
295 a239 2
296 This alows interfacing to non-standard mail systems,
297 ones that don't believe in delimiter-separated mailboxes
298 @