.mh_alias File Format

Purpose

Defines aliases.

Description

An alias file contains lines that associate an alias name with an address or group of addresses. The Message Handler (MH) package reads both personal alias files (customarily the $HOME/.mh_alias file) and a systemwide alias file, the /etc/mh/MailAliases file. Depending on the MH configuration, aliases may also be defined in the /etc/aliases file (see the sendmail command).

The alias file name is an argument to several MH commands. These commands can be set automatically by entries in the .mh_profile file. Personal alias files can have any name, but must follow the format described here. The /etc/mh/MailAliases file is the default alias file for systemwide aliases. This file is set up by a user with root user authority.

Specify your personal alias file in your .mh_profile file. Otherwise, you must use the -alias flag each time you use an MH command that requires this flag.

Each line of an .mh_alias file has one of the following formats:

  • Alias : Address-Group
  • Alias ; Address-Group
  • <Alias-File

The variables are described as follows:

Item Description
Alias Specifies a simple address.
Address Specifies a simple Internet-style address.
Group Specifies a group name (or number) from the /etc/group file.
Alias-File Specifies a system file name. The MH package treats alias file names as case-sensitive. Alias expansion is case-sensitive as well.

The Address-Group variable can be either of the following:

Item Description
AddressList List of addresses that make up a group.
<Alias-File System file to be read for more alias definitions.

The addresses in the AddressList variable must be separated by commas.

Note: f there are references to aliases within an alias definition, those aliases must be defined in a following line of the alias file.

Special Characters

Item Description
\ (backslash) You can continue an alias definition on the next line by ending the line to be continued with a \ (backslash) followed by a new-line character.
< (less than) If a line starts with a < (less-than sign), MH reads the file specified after the less-than sign for more alias definitions. The reading is done recursively.

If an address group starts with a < (less-than sign), MH reads the file specified after the less-than sign and adds the contents of that file to the address list for the alias.

= (equal) If an address group starts with an = (equal sign), MH consults the /etc/group file for the group specified after an equal sign. The MH package adds each login name occurring as a member of the group to the address list for the alias.
+ (plus) If an address group starts with a + (plus sign), MH consults the /etc/group file to determine the ID of the group. Each login name appearing in the /etc/passwd file that matches the address group is added to the address list for the alias.
* (asterisk) If an address group is defined by an * (asterisk), MH consults the /etc/passwd file and adds all login names with a user number greater than 200 (or the value set for everyone in the /etc/mh/mtstailor file) to the address list for the alias.

The following list explains how the system resolves aliases at posting time:

  1. The system builds a list of all addresses from the message to be delivered, eliminating duplicate addresses.
  2. If the draft originated on the local host, the system performs alias resolution for addresses that have no specified host.
  3. For each line in the alias file, the system compares the alias with all existing addresses. If a match is found, the system removes the matched alias from the address list. The system then adds each new address in the address group to the address list. The alias itself is not usually output. Instead, the address group to which the alias maps is output. If the alias is terminated with a ; (semicolon) instead of a : (colon), both the alias and the address are output in the correct form. (This correct form makes replies possible since MH aliases and personal aliases are unknown to the mail transport system.)

In pattern matching, a trailing * (asterisk) in an alias matches just about anything appropriate.

Examples

The following example of an .mh_alias file illustrates some of its features:

</home/sarah/morealiases
systems:= systems
staff:+ staff
everyone:+*
manager: harold@harold
project:lance,mark@remote,peter,manager

The first line says that more aliases should be read from the /home/sarah/morealiases file. The systems alias is defined as all users listed as members of the group systems in the /etc/group file. The staff alias is defined as all users whose group ID in the /etc/passwd file is equivalent to the staff group. Finally, the everyone alias is defined as all users with a user ID in the /etc/passwd file greater than 200.

The manager alias is defined as an alias for user harold@harold. The project alias is defined as the users lance, mark@remote, peter, and manager.

Files

Item Description
/etc/aliases Contains systemwide aliases for the sendmail command.
/etc/group Contains basic group attributes.
/etc/passwd Contains user authentication information.
/etc/mh/MailAliases Contains the defaults alias file for systemwide aliases, which is set up by a user with root user authority.
/etc/mh/mtstailor Tailors the Message Handler (MH) environment to the local environment.
.mh_profile Customizes the Message Handler (MH) package.