An alias allows sendmail to redirect mail sent to a given address. This mail can be redirected to another email address, a file, or piped through a program.

sendmail's alias database is usually kept in flat-text format in the file /etc/aliases. The file consists of commented lines (starting with #) and any number of key and value pairs, one per line, delimited by a :. So, for example:

# RFC 822 requires that every host have a mail address "postmaster" 
postmaster      : root
This aliases postmaster to root, so that any mail sent to postmaster will instead be delivered to root.

Aliases can also be redirected to a file, like this:

# Aliases to handle mail to msgs and news
nobody          : /dev/null
Or piped to a program, like this:
# an automatic bug-registering database
program-bugs: |/usr/local/bin/program-bug-tracker
You can also specify multiple places to redirect mail by seperating them with commas:
# a makeshift mailing list
Thus, a mail to project-list will be forwarded to all of the addresses listed.

sendmail cannot directly read this flat-text version of the aliases file. Instead, it converts this to a binary database (either DB or DBM, depending on which you compiled it with) when you use the newaliases command. Every time you make changes to /etc/aliases, you must run newaliases to update the database.

Mark D. Roth <>