ali: Either read default alias files or the ones on command line.
[mmh] / man / mh-alias.man5
1 .\"
2 .\" %nmhwarning%
3 .\"
4 .TH MH-ALIAS %manext5% "%nmhdate%" MH.6.8 [%nmhversion%]
5 .SH NAME
6 mh-alias \- alias file for nmh message system
7 .SH SYNOPSIS
8 any
9 .B nmh
10 command
11 .SH DESCRIPTION
12 This describes
13 .B nmh
14 personal alias files.
15 It does
16 .B not
17 describe aliases files used by the message transport system.
18 Each line of the alias file has the format:
19 .PP
20 .RS 5
21 .I alias
22 .B :
23 .I address\-group
24 .RE
25 or
26 .RS 5
27 .I alias
28 .B ;
29 .I address\-group
30 .RE
31 or
32 .RS 5
33 .B <
34 .I alias\-file
35 .RE
36 or
37 .RS 5
38 .B ;
39 .I comment
40 .RE
41 .PP
42 where:
43 .PP
44 .RS 5
45 .nf
46 .IR address\-group "    := " address\-list
47 .RI "                   |  < " file
48 .RI "                   |  = " UNIX\-group
49 .RI "                   |  + " UNIX\-group
50                         |  *
51
52 .IR address\-list "     := " address
53 .RI "                   |  " address\-list ", " address
54 .fi
55 .RE
56 .PP
57 Continuation lines in alias files end with `\\' followed by the newline
58 character.
59 .PP
60 .RI `  Alias\-file '
61 and
62 .RI ` file '
63 are UNIX file names.
64 .I UNIX\-group
65 is a group name (or number) from
66 .IR /etc/group .
67 An address is a `simple'
68 Internet\-style address.  Througout this file, case is ignored, except
69 for file names.
70 .PP
71 If the line starts with a `<', then the file named after the `<' is
72 read for more alias definitions.  The reading is done recursively, so a
73 `<' may occur in the beginning of an alias file with the expected results.
74 .PP
75 If the
76 .I address\-group
77 starts with a `<', then the file named after the
78 `<' is read and its contents are added to the
79 .I address\-list
80 for the alias.
81 .PP
82 If the
83 .I address\-group
84 starts with an `=', then the file
85 .I /etc/group
86 is consulted for the UNIX\-group named after the `='.  Each login name
87 occurring as a member of the group is added to the
88 .I address\-list
89 for the alias.
90 .PP
91 In contrast, if the
92 .I address\-group
93 starts with a `+', then the file
94 .I /etc/group
95 is consulted to determine the group\-id of the
96 UNIX\-group named after the `+'.  Each login name occurring in the
97 .I /etc/passwd
98 file whose group\-id is indicated by this group is
99 added to the
100 .I address\-list
101 for the alias.
102 .PP
103 In match, a trailing `*' on an alias will match just about anything
104 appropriate.  (See example below.)
105 .PP
106 An approximation of the way aliases are resolved at posting time is
107 (it's not really done this way):
108 .PP
109 .RS 2
110 .IP 1) 3
111 Build a list of all addresses from the message to be delivered,
112 eliminating duplicate addresses.
113 .PP
114 .IP 2) 3
115 If this draft originated on the local host, then for those addresses in
116 the message that have no host specified, perform alias resolution.
117 .PP
118 .IP 3) 3
119 For each line in the alias file, compare `alias' against all of
120 the existing addresses.  If a match, remove the matched `alias'
121 from the address list, and add each new address in the address\-group to
122 the address list if it is not already on the list.  The alias itself is
123 not usually output, rather the address\-group that the alias maps to is
124 output instead.  If `alias' is terminated with a `;' instead of
125 a `:', then both the `alias' and the address are output in the
126 correct format.  (This makes replies possible since personal
127 .B nmh
128 aliases are unknown to the mail transport system.)
129 .RE
130 .PP
131 Since the alias file is read line by line, forward references work, but
132 backward references are not recognized, thus, there is no recursion.
133 .PP
134 Example Alias File:
135 .PP
136 .RS 5
137 .nf
138 <%etcdir%/MoreAliases
139 sgroup: fred, fear, freida
140 b-people: Blind List: bill, betty;
141 fred: frated@UCI
142 UNIX\-committee: <unix.aliases
143 staff: =staff
144 wheels: +wheel
145 news.*: news
146 .fi
147 .RE
148 .PP
149 The first line says that more aliases should immediately be read from
150 the file
151 .IR %etcdir%/MoreAliases .
152 Following this, `fred'
153 is defined as an alias for `frated@UCI', and `sgroup'
154 is defined as an alias for the three names `frated@UCI',
155 'fear', and 'freida'.
156 .PP
157 The alias `b-people' is a blind list which includes the addresses
158 `bill' and `betty'; the message will be delieved to those
159 addresses, but the message header will  show only `Blind List: ;'
160 (not the addresses).
161 .PP
162 Next, the definition of `UNIX\-committee' is given by
163 reading the file
164 .I unix.aliases
165 in the users
166 .B mmh
167 directory,
168 `staff' is defined as all users who are listed as members of the
169 group `staff' in the
170 .I /etc/group
171 file, and `wheels'
172 is defined as all users whose group\-id in
173 .I /etc/passwd
174 is equivalent to the `wheel' group.
175 .PP
176 Finally, all aliases of the form
177 `news.<anything>' are defined to be `news'.
178 .PP
179 The key thing to understand about aliasing in
180 .B nmh
181 is that aliases in
182 .B nmh
183 alias files are expanded into the headers of messages posted.
184 This aliasing occurs first, at posting time, without the knowledge of the
185 message transport system.  In contrast, once the message transport system
186 is given a message to deliver to a list of addresses, for each address
187 that appears to be local, a system\-wide alias file is consulted.  These
188 aliases are
189 .B NOT
190 expanded into the headers of messages delivered.
191
192 .SH "HELPFUL HINTS"
193 To use aliasing in
194 .B nmh
195 quickly, do the following:
196 .PP
197 .RS 2
198 .IP 1) 3
199 In your
200 .IR .mmh/profile ,
201 choose a name for your alias file, say
202 .RI ` aliases ',
203 and add the line:
204 .PP
205 .RS 5
206 .nf
207 Aliasfile: aliases
208 .fi
209 .RE
210 .PP
211 .IP 2) 3
212 Create the file
213 .RI ` aliases '
214 in your
215 .B mmh
216 directory.
217 .PP
218 .IP 3) 3
219 Start adding aliases to your
220 .RI ` aliases '
221 file as appropriate.
222 .RE
223
224 .SH FILES
225 None
226
227 .SH "PROFILE COMPONENTS"
228 .fc ^ ~
229 .nf
230 .ta 2.4i
231 .ta \w'ExtraBigProfileName  'u
232 ^Aliasfile:~^For a default alias file
233 .fi
234
235 .SH "SEE ALSO"
236 ali(1), send(1), group(5), passwd(5), post(8)
237
238 .SH CONTEXT
239 None
240
241 .SH HISTORY
242 An address group named `*', meaning everyone on the system, had been
243 supported in nmh. It is not anymore in mmh.
244
245 .SH BUGS
246 Although the forward-referencing semantics of
247 .B mh\-alias
248 files prevent recursion, the
249 .RI `< " alias\-file" '
250 command may defeat this.
251 Since the number of file descriptors is finite (and very limited), such
252 infinite recursion will terminate with a meaningless diagnostic when
253 all the fds are used up.
254 .PP
255 Forward references do not work correctly inside blind lists.