Scroll to navigation

MH-ALIAS(5mh) [mmh-0.4] MH-ALIAS(5mh)


mh-alias - alias file for mh message system


This describes mh personal alias files. It does not describe aliases files used by the message transport system.

Each line of the alias file has the format:

alias : address-group
alias ; address-group
< alias-file
; comment


address-group	:= address-list
			|  < file
			|  = UNIX-group
			|  + UNIX-group
			|  *
address-list	:= address
			|  address-list, address

Continuation lines in alias files end with `\' followed by the newline character.

`Alias-file' and `file' are UNIX file names. UNIX-group is a group name (or number) from /etc/group. An address is a `simple' Internet-style address. Throughout this file, case is ignored, except for file names.

If the line starts with a `<', then the file named after the `<' is read for more alias definitions. The reading is done recursively, so a `<' may occur in the beginning of an alias file with the expected results.

If the address-group starts with a `<', then the file named after the `<' is read and its contents are added to the address-list for the alias.

If the address-group starts with an `=', then the file /etc/group is consulted for the UNIX-group named after the `='. Each login name occurring as a member of the group is added to the address-list for the alias.

In contrast, if the address-group starts with a `+', then the file /etc/group is consulted to determine the group-id of the UNIX-group named after the `+'. Each login name occurring in the /etc/passwd file whose group-id is indicated by this group is added to the address-list for the alias. I.e. only those users that have this group as their initial login group are added.

In match, a trailing `*' on an alias will match just about anything appropriate. (See example below.)

An approximation of the way aliases are resolved at posting time is (it's not really done this way):

Build a list of all addresses from the message to be delivered, eliminating duplicate addresses.
If this draft originated on the local host, then for those addresses in the message that have no host specified, perform alias resolution.
For each line in the alias file, compare `alias' against all of the existing addresses. If a match, remove the matched `alias' from the address list, and add each new address in the address-group to the address list if it is not already on the list. The alias itself is not usually output, rather the address-group that the alias maps to is output instead. If `alias' is terminated with a `;' instead of a `:', then both the `alias' and the address are output in the correct format. (This makes replies possible since personal mh aliases are unknown to the mail transport system.)

Since the alias file is read line by line, forward references work, but backward references are not recognized, thus, there is no recursion.

Example Alias File:

sgroup: fred, fear, freida
b-people: Blind List: bill, betty
fred: frated@UCI
UNIX-committee: <unix.aliases
staff: =staff
wheels: +wheel
news.*: news

The first line says that more aliases should immediately be read from the file /etc/mmh/MoreAliases. Following this, `fred' is defined as an alias for `frated@UCI', and `sgroup' is defined as an alias for the three names `frated@UCI', `fear', and `freida'.

The alias `b-people' is a blind list which includes the addresses `bill' and `betty'; the message will be delieved to those addresses, but the message header will show only `Blind List: ;' (not the addresses).

Next, the definition of `UNIX-committee' is given by reading the file unix.aliases in the users mmh directory, `staff' is defined as all users who are listed as members of the group `staff' in the /etc/group file, and `wheels' is defined as all users whose group-id in /etc/passwd is equivalent to the `wheel' group.

Finally, all aliases of the form `news.<anything>' are defined to be `news'.

The key thing to understand about aliasing in mh is that aliases in mh alias files are expanded into the headers of messages posted. This aliasing occurs first, at posting time, without the knowledge of the message transport system. In contrast, once the message transport system is given a message to deliver to a list of addresses, for each address that appears to be local, a system-wide alias file is consulted. These aliases are NOT expanded into the headers of messages delivered.


To use aliasing in mmh quickly, do the following:

In your .mmh/profile, choose a name for your alias file, say `aliases', and add the line:

Aliasfile: aliases
Create the file `aliases' in your mmh directory.
Start adding aliases to your `aliases' file as appropriate.

Earlier versions of this man page showed a semicolon at the end of the blind list example. That caused the preceding alias to not be expanded. There must not be a semicolon at the end of, or within, the address group of a blind list. post will append the semicolon to the blind list name.




^Aliasfile:~^For a default alias file


ali(1), send(1), group(5), passwd(5), post(8)




An address group named `*', meaning everyone on the system, had been supported in nmh. It is not anymore in mmh.


Although the forward-referencing semantics of mh-alias files prevent recursion, the `< alias-file' command may defeat this. Since the number of file descriptors is finite (and very limited), such infinite recursion will terminate with a meaningless diagnostic when all the fds are used up.

2019-01-06 MH.6.8