]> diplodocus.org Git - nmh/blob - man/mh-alias.man
sbr/utils.c: Add HasSuffix(s, suffix).
[nmh] / man / mh-alias.man
1 .TH MH-ALIAS %manext5% "November 15, 2014" "%nmhversion%"
2 .\"
3 .\" %nmhwarning%
4 .\"
5 .SH NAME
6 mh-alias \- format of nmh alias files
7 .SH DESCRIPTION
8 .PP
9 Each line of an
10 .B nmh
11 alias file takes one of the following forms:
12 .PP
13 .RS 5
14 .I alias
15 .B :
16 .I address\-group
17 .RE
18 .sp
19 .RS 5
20 .I alias
21 .B ;
22 .I address\-group
23 .RE
24 .sp
25 .RS 5
26 .B <
27 .I alias\-file
28 .RE
29 .sp
30 .RS 5
31 .B ;
32 |
33 .B :
34 |
35 .B #
36 .I comment
37 .RE
38 .PP
39 where:
40 .PP
41 .RS 5
42 .nf
43 .IR address\-group " := " address\-list
44 .RI " | < " file
45 .RI " | = " UNIX\-group
46 .RI " | + " UNIX\-group
47
48 .IR address\-list " := " address
49 .RI " | " address\-list ", " address
50 .fi
51 .RE
52 .PP
53 Continuation lines end with \*(lq\\\*(rq followed by a newline
54 character. This also applies to comment lines. Thus, the line following a
55 \*(lq\\\*(rq\-terminated
56 comment line is a continuation of
57 that comment line.
58 .PP
59 .I Alias\-file
60 and
61 .I file
62 are UNIX file names.
63 .I UNIX\-group
64 is a group name or number from
65 the system's group database.
66 Alias file contents are case-insensitive, with the exception
67 of filesystem path names.
68 .PP
69 If the line starts with a \*(lq<\*(rq, the file named after the \*(lq<\*(rq is
70 read for more alias definitions. The reading is done recursively, so a
71 \*(lq<\*(rq may occur in the beginning of an alias file with the expected results.
72 .PP
73 If the
74 .I address\-group
75 starts with a \*(lq<\*(rq, the file named after the
76 \*(lq<\*(rq is read and its contents are added to the
77 .I address\-list
78 for the alias.
79 .PP
80 If the
81 .I address\-group
82 starts with an \*(lq=\*(rq, the
83 system's group database
84 is consulted for the UNIX\-group named after the \*(lq=\*(rq. Each login name
85 occurring as a member of the group is added to the
86 .I address\-list
87 for the alias.
88 .PP
89 In contrast, if the
90 .I address\-group
91 starts with a \*(lq+\*(rq, the system's group database
92 is consulted to determine the group\-id of the
93 UNIX\-group named after the \*(lq+\*(rq. Each login name occurring in the
94 system's password database
95 whose group\-id is indicated by this group is
96 added to the
97 .I address\-list
98 for the alias.
99 .PP
100 In match, a trailing \*(lq*\*(rq on an alias will match just about anything
101 appropriate.
102 .PP
103 An approximation of the way aliases are resolved at posting time is:
104 .IP 1)
105 Build a list of all addresses from the message to be delivered,
106 eliminating duplicate addresses.
107 .IP 2)
108 For those addresses in the message that have no host specified,
109 perform alias resolution.
110 .IP 3)
111 For each line in the alias file, compare \*(lqalias\*(rq against all of
112 the existing addresses. If a match, remove the matched \*(lqalias\*(rq
113 from the address list, and add each new address in the address\-group to
114 the address list if it is not already on the list. The alias itself is
115 not usually output, rather the address\-group that the alias maps to is
116 output instead. If \*(lqalias\*(rq is terminated with a \*(lq;\*(rq instead of
117 a \*(lq:\*(rq, then both the \*(lqalias\*(rq and the address are output in the
118 correct format (with the alias quoted if necessary and the address
119 wrapped in <>).
120 .PP
121 Since the
122 .I mh-alias
123 file is read line by line, forward references work, but
124 backward references are not recognized.
125 .SS
126 Example Alias File
127 .PP
128 .RS 5
129 .nf
130 <%nmhetcdir%/BBoardAliases
131 fred: frated@UCI.example
132 sgroup: fred, fear, freida
133 b-people: Blind List: bill, betty
134 UNIX\-committee: <unix.aliases
135 staff: =staff
136 wheels: +wheel
137 news.*: news
138 .fi
139 .RE
140 .PP
141 The first line says that more aliases should immediately be read from
142 the file
143 .BR %nmhetcdir%/BBoardAliases .
144 Following this, \*(lqfred\*(rq
145 is defined as an alias for \*(lqfrated@UCI.example\*(rq, and \*(lqsgroup\*(rq
146 is defined as an alias for the three names \*(lqfrated@UCI.example\*(rq,
147 \*(rqfear\*(rq, and \*(rqfreida\*(rq.
148 .PP
149 The alias \*(lqb-people\*(rq is a blind list which includes the addresses
150 \*(lqbill\*(rq and \*(lqbetty\*(rq; the message will be delivered to those
151 addresses, but the message header will show only \*(lqBlind List: ;\*(rq
152 (not the addresses). The alias must not be terminated with, or contain,
153 a semicolon.
154 Note that blind lists are not supported with the
155 .B sendmail/pipe
156 mail transport method.
157 .PP
158 Next, the definition of \*(lqUNIX\-committee\*(rq is given by
159 reading the file
160 .I unix.aliases
161 in the user's
162 .B nmh
163 directory,
164 \*(lqstaff\*(rq is defined as all users who are listed as members of the
165 group \*(lqstaff\*(rq in the
166 system's group database, and \*(lqwheels\*(rq
167 is defined as all users whose group\-id in
168 the system's password database
169 is equivalent to the \*(lqwheel\*(rq group.
170 .SH "PROFILE COMPONENTS"
171 .TP 20
172 Aliasfile:
173 Default alias file.
174 .SH FILES
175 .TP 20
176 %nmhetcdir%/MailAliases
177 System-wide default alias file.
178 .SH "SEE ALSO"
179 .IR ali (1),
180 .IR send (1),
181 .IR whom (1),
182 .IR getgrent (3),
183 .IR getpwent (3),
184 .IR post (8)
185 .SH BUGS
186 Although the forward-referencing semantics of
187 mh\-alias
188 files prevent recursion, the
189 .B alias\-file
190 directive may defeat this.
191 Since the number of file descriptors is finite, such
192 infinite recursion will terminate with a meaningless diagnostic when
193 all the fds are used up.
194 .PP
195 Earlier versions of this man page showed a semicolon at the end of the
196 blind list example. That caused the preceding alias to not be
197 expanded. There must not be a semicolon at the end of, or within, the
198 address group of a blind list.
199 .B post
200 will append the semicolon to the blind list name.