|
|
HP-UX Mailing Services Administrator's Guide: HP-UX 11i v1 and HP-UX 11i v2 > Chapter 2 Configuring
and Administering SendmailCreating Sendmail Aliases |
|
The Sendmail aliases database stores mailing lists and mail aliases. You must create the aliases database by adding aliases to the file /etc/mail/aliases and then by running the /usr/sbin/newaliases command to generate the database from the file. The generated alias database is stored in the file /etc/mail/aliases.db. The Sendmail startup script also generates the aliases database when you reboot your system. Each user on your system can create a list of alternate mailing addresses in a .forward file in the user’s home directory. The .forward file allows users to forward their own mail to files or to other mailing addresses. This section discusses the following topics:
To add Sendmail aliases to the database, follow these steps:
Table 2-1 Mailing List Options
An alias can be continued across multiple lines in the aliases file. Lines beginning with blanks or tabs are continuation lines. The aliases file can contain comment lines, which begin with the pound sign (#). Blank lines in the aliases file are ignored.
Sendmail enables you to configure an owner for a mailing list, because the sender of a message often does not control the mailing list to which the message is addressed. If Sendmail encounters an error while attempting to deliver a message to the members of a mailing list, it looks for an alias of the form owner-mailing_list and sends the error message to the owner. For example, if mike were responsible for maintaining the chess_club mailing list, he could be configured as the owner:
Any errors that Sendmail encounters while trying to deliver mail to the members of the chess_club mailing list would be reported to mike. You must avoid creating aliasing loops. Loops can occur either locally or remotely. An example of a local alias loop is as follows:
While regenerating the alias database, the newaliases command does not notice a loop like the one shown in the previous example. However, after the alias database is generated, mail addressed to either first or second is not sent. If the recipients for the message are only in the local alias loops, the message is returned with the error message All recipients suppressed. In the previous example, if mail is addressed to first, first expands to second, which expands back to first. This causes Sendmail to remove first from the recipient list as a duplicate.
The following is an example of a remote aliasing loop: Mail sent to dave at either host sage or host basil bounces between the two systems. Sendmail adds a tracing header line (Received:) with each hop. When 26 tracing header lines have been added, Sendmail recognizes the aliasing loop and aborts the delivery with an error message. RFC 2822 requires that a postmaster alias be defined on every host. The postmaster is the person in charge of handling problems with the mail system on that host. The default aliases file supplied with the HP-UX operating system designates the postmaster as root. You can change this alias to the appropriate user for your system. After you have created a Sendmail alias and regenerated the aliases database, issue the following command to verify the validity of your alias:
The -bv option causes Sendmail to verify the aliases without collecting or sending any messages. Any errors in the specified aliases are logged to standard output. You can use the HP expand_alias utility to expand an alias or mailing list as far as possible. For more information on the expand_alias utility, type man 1M expand_alias at the HP-UX prompt. You can manage the Sendmail aliases database through the Network Information Service (NIS or NIS+), which is one of the NFS Services. This service allows you to maintain an aliases database on one server system. All other systems request alias information from the server. In order to use NIS or NIS+, you must set up an NIS or NIS+ domain and configure the machines in your network as NIS or NIS+ servers and clients. For information about the NIS or NIS+ aliases database, see the manual Installing and Administering NFS Services, at the URL http://www.docs.hp.com/hpux/onlinedocs/B1031-90048/B1031-90048.html. When you configure NIS or NIS+ on your network, it manages your Sendmail aliases by default, so you do not have to make any changes to your NIS or NIS+ configuration. Before you run the NIS ypinit script or the NIS+ nispopulate script, ensure that the /etc/mail/aliases file on the NIS or NIS+ master server contains all the Sendmail aliases that you want to make globally available through NIS or NIS+. The Sendmail program uses the Name Service Switch to determine where to look for Sendmail aliases. HP provides a method that allows the From line on a mail message to be rewritten. This can be useful when a user’s login name does not clearly identify the user to intended mail recipients. For example, mail sent by bkelley (mailname) can be changed to read as Bob_Kelley (maildrop). To rewrite From lines on an outgoing mail message, do the following:
You can redirect your own mail by creating a .forward file in your home directory. If a .forward file exists in your home directory and is owned by you, Sendmail redirects mail addressed to you to the addresses that the .forward file contains. A .forward file can contain anything that appears on the right side of an alias definition, including programs and files. (See Table 2-1 “Mailing List Options” earlier in this chapter.) The following is an example of a .forward file owned by user alice on host chicago:
Mail sent to alice@chicago will be delivered to alice’s accounts on hosts miami and toronto, and to her account on local host chicago. It will also be delivered to all the recipients of the mailing list mycrew, which must be defined in the local aliases database or in the :include file on host chicago. The aliases database is read before a .forward file. The .forward file is read only if the user’s name is not defined as an alias or if an alias expands to the user’s name. |
|