9 date 92.10.26.17.02.08; author jromine; state Exp;
14 date 92.10.26.17.01.26; author jromine; state Exp;
25 @fixes from Jerry Peek. These should probably be sent to bug-mmdf as well.
33 .nr P- \\n()P \" save the preceeding IP space
34 .nr )P 0 \" now set it to 0
36 .nr )P \\n(P- \" restore the preceeding IP space
38 .ds M \fI.maildelivery\fP
39 .TH MAILDELIVERY 5 "1 October, 1985"
43 User delivery specification file
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.
51 If the address indicates a pipe or file default
52 then that is carried out.
55 (or something similar) in the home directory is read if it exists
56 and the actions in it are followed.
58 A system-wide file is consulted next, such as
59 .I /usr/lib/maildelivery
60 and the actions are similar to 2.
62 If the message still hasn't been delivered, then it is put into
63 the user's normal mailbox
67 depending on the system.
70 The format of the \*M file is
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 :-
93 The out of band sender information. This is the address MMDF would
94 use for reporting delivery problems with the message.
96 the address that was used to mail to you, normally 'yourname' or
97 \&'yourname=string' (see below).
99 if the message hasn't been delivered yet, this field is matched.
101 this case is always true regardless of any other action.
104 is some sequence of characters that may be matched in the
107 Case is not significant.
109 is one of the mail delivery actions supported by the
110 local channel. Currently the supported actions are
115 appends the message to the given file, with delimiters;
119 which starts up a process with the message
120 as the standard input;
123 which throws the message away.
128 which fakes a pipe command and is quicker than the standard pipe,
129 but does not do header reformatting.
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.
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:
144 If the result of this line's action is OK, then the message can be
145 considered delivered.
147 The message is not to be considered delivered by this action.
149 This is equivalent to
151 except that the action is not carried
152 out if the message has already been accepted.
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
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').
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
174 string of the \*M file.
175 For example, if you were to
176 subscribe to a digest as "foo=digest@@bar.NET",
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
185 The environment in which piped programs are run
186 contains a few standard features, specifically:
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).
195 The default umask is set up to 077, this gives a very protective
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.
201 There are certain built-in variables that you can give to
202 a piped program. These are
210 is set to the return address for the message.
212 is set to the address that was used to mail to you, normally `yourname'
213 or `yourname=string'.
215 is set to the size in bytes of this message.
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.
220 is the info field from the internal mail header and is probably only
221 of interest to the system maintainers.
224 Here is a rough idea of what a \*M file looks like:
228 # lines \fIstarting\fP with a '#' are ignored.
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
253 \- the file's normal location.
255 /usr/lib/maildelivery \-
256 the system file. This should be protected against attack. It
257 may contain contents such as:
261 default~~~~\-~~~~pipe~~~~A~~~~stdreceive
262 *~~~~\-~~~~|~~~~R~~~~ttynotify
265 This allows interfacing to non-standard mail systems,
266 ones that don't believe in delimiter-separated mailboxes.
281 'yourname=string' (see below).
284 failure occured and the message should be rejected, these error codes
287 Initgroups is called if 4.2 version of UNIX is running.
290 Addr~~~~jpo=ack~~~~|~~~~R~~~~resend~~\-r~~$(reply-to)
293 \- the files normal location.
296 This alows interfacing to non-standard mail systems,
297 ones that don't believe in delimiter-separated mailboxes