Initial revision
[mmh] / man / mh-alias.man
1 .\"
2 .\" %nmhwarning%
3 .\" $Id$
4 .\"
5 .\" include the -mh macro file
6 .so %etcdir%/tmac.h
7 .\"
8 .TH MH-ALIAS %manext5% MH.6.8 [%nmhversion%]
9 .SH NAME
10 mh-alias \- alias file for nmh message system
11 .SH SYNOPSIS
12 .in +.5i
13 .ti -.5i
14 any \fInmh\fR command
15 .in -.5i
16 .SH DESCRIPTION
17 This describes both \fInmh\fR personal alias files and
18 the global alias file for nmh mail delivery, the file
19
20         %etcdir%/MailAliases
21
22 It does \fBnot\fR describe aliases files used by the message transport system.
23 Each line of the alias file has the format:
24
25         alias : address\-group
26 .br
27 or
28 .br
29         alias ; address\-group
30 .br
31 or
32 .br
33         < alias\-file
34 .br
35 or
36 .br
37         ; comment
38 .br
39
40 where:
41
42         address\-group  :=  address\-list
43 .br
44                        |   \*(lq<\*(rq file
45 .br
46                        |   \*(lq=\*(rq UNIX\-group
47 .br
48                        |   \*(lq+\*(rq UNIX\-group
49 .br
50                        |   \*(lq*\*(rq
51
52 .br
53         address\-list   :=  address
54 .br
55                        |   address\-list, address
56 .br
57
58 Continuation lines in alias files end with `\\' followed by the newline
59 character.
60
61 Alias\-file and file are UNIX file names.  UNIX\-group is a group name
62 (or number) from \fI/etc/group\fR.  An address is a \*(lqsimple\*(rq
63 Internet\-style address.  Througout this file, case is ignored, except
64 for alias\-file names.
65
66 If the line starts with a `<', then the file named after the `<' is
67 read for more alias definitions.  The reading is done recursively, so a
68 `<' may occur in the beginning of an alias file with the expected results.
69
70 If the address\-group starts with a `<', then the file named after the
71 `<' is read and its contents are added to the address\-list for the alias.
72
73 If the address\-group starts with an `=', then the file \fI/etc/group\fR
74 is consulted for the UNIX\-group named after the `='.  Each login name
75 occurring as a member of the group is added to the address\-list for
76 the alias.
77
78 In contrast, if the address\-group starts with a `+', then the file
79 \fI/etc/group\fR is consulted to determine the group\-id of the
80 UNIX\-group named after the `+'.  Each login name occurring in the
81 \fI/etc/passwd\fR file whose group\-id is indicated by this group is
82 added to the address\-list for the alias.
83
84 If the address\-group is simply `*', then the file \fI/etc/passwd\fR is
85 consulted and all login names with a userid greater than some magic number
86 (usually 200) are added to the address\-list for the alias.
87
88 In match, a trailing * on an alias will match just about anything
89 appropriate.  (See example below.)
90
91 An approximation of the way aliases are resolved at posting time is
92 (it's not really done this way):
93
94 .in +.5i
95 1) Build a list of all addresses from the message to be delivered,
96 eliminating duplicate addresses.
97
98 2) If this draft originated on the local host, then for those addresses in
99 the message that have no host specified, perform alias resolution.
100
101 3) For each line in the alias file, compare \*(lqalias\*(rq against all of
102 the existing addresses.  If a match, remove the matched \*(lqalias\*(rq
103 from the address list, and add each new address in the address\-group to
104 the address list if it is not already on the list.  The alias itself is
105 not usually output, rather the address\-group that the alias maps to is
106 output instead.  If \*(lqalias\*(rq is terminated with a `;' instead of
107 a `:', then both the \*(lqalias\*(rq and the address are output in the
108 correct format.  (This makes replies possible since \fInmh\fR aliases
109 and personal aliases are unknown to the mail transport system.)
110 .in -.5i
111
112 Since the alias file is read line by line, forward references work, but
113 backward references are not recognized, thus, there is no recursion.
114
115 .ne 10
116 \fBExample:\fR
117 .nf
118 .in +.5i
119 <%etcdir%/BBoardAliases
120 sgroup: fred, fear, freida
121 b-people: Blind List: bill, betty;
122 fred: frated@UCI
123 UNIX\-committee: <unix.aliases
124 staff: =staff
125 wheels: +wheel
126 everyone: *
127 news.*: news
128 .in -.5i
129 .fi
130
131 The first line says that more aliases should immediately be read from
132 the file \fI%etcdir%/BBoardAliases\fR.  Following this, \*(lqfred\*(rq
133 is defined as an alias for \*(lqfrated@UCI\*(rq, and \*(lqsgroup\*(rq
134 is defined as an alias for the three names \*(lqfrated@UCI\*(rq,
135 \*(rqfear\*(rq, and \*(rqfreida\*(rq.
136 .sp
137 The alias \*(lqb-people\*(rq is a blind list which includes the addresses
138 \*(lqbill\*(rq and \*(lqbetty\*(rq; the message will be delieved to those
139 addresses, but the message header will  show only \*(lqBlind List: ;\*(rq
140 (not the addresses).
141 .sp
142 Next, the definition of \*(lqUNIX\-committee\*(rq is given by
143 reading the file \fIunix.aliases\fR in the users \fInmh\fR directory,
144 \*(lqstaff\*(rq is defined as all users who are listed as members of the
145 group \*(lqstaff\*(rq in the \fI/etc/group\fR file, and \*(lqwheels\*(rq
146 is defined as all users whose group\-id in \fI/etc/passwd\fR is equivalent
147 to the \*(lqwheel\*(rq group.
148 .sp
149 Finally, \*(lqeveryone\*(rq is defined as all users with a user\-id
150 in \fI/etc/passwd\fR greater than 200, and all aliases of the form
151 \*(lqnews.<anything>\*(rq are defined to be \*(lqnews\*(rq.
152
153 The key thing to understand about aliasing in \fInmh\fR is that aliases
154 in \fInmh\fR alias files are expanded into the headers of messages posted.
155 This aliasing occurs first, at posting time, without the knowledge of the
156 message transport system.  In contrast, once the message transport system
157 is given a message to deliver to a list of addresses, for each address
158 that appears to be local, a system\-wide alias file is consulted.  These
159 aliases are \fBNOT\fR expanded into the headers of messages delivered.
160 .Hh
161 To use aliasing in \fInmh\fR quickly, do the following:
162
163 .in +.5i
164 First, in your \fI\&.mh\(ruprofile\fR, choose a name for your alias
165 file, say \*(lqaliases\*(rq, and add the line:
166
167 .nf
168 .in +.5i
169 Aliasfile: aliases
170 .\" ali: \-alias aliases
171 .\" send: \-alias aliases
172 .\" whom: \-alias aliases
173 .in -.5i
174 .fi
175
176 Second, create the file \*(lqaliases\*(rq in your \fInmh\fR directory.
177
178 Third, start adding aliases to your \*(lqaliases\*(rq file as appropriate.
179 .in -.5i
180 .Fi
181 ^%etcdir%/MailAliases~^global nmh alias file
182 .Pr
183 ^Aliasfile:~^For a default alias file
184 .Sa
185 ali(1), send(1), whom(1), group(5), passwd(5), conflict(8), post(8)
186 .De
187 None
188 .Co
189 None
190 .Bu
191 Although the forward-referencing semantics of \fImh\-alias\fR files
192 prevent recursion, the \*(lq<\ alias\-file\*(rq command may defeat this.
193 Since the number of file descriptors is finite (and very limited), such
194 infinite recursion will terminate with a meaningless diagnostic when
195 all the fds are used up.
196 .sp
197 Forward references do not work correctly inside blind lists.
198 .En