The alias file is called aliases.dat
. Courier looks for
aliases.dat
first in the
${COURIER_HOME}/$ARCH/lib/modules/MODULE
directory. If not found,
Courier looks for aliases.dat
in ${COURIER_HOME}/lib
. This
lets you define aliases that can be mailed to only locally, or define system
wide aliases.
Please note that if lib/modules/MODULE/aliases.dat
exists, and the
E-mail address is not found there, Courier wll try again using
lib/aliases.dat
.
makealiases
aliases.dat
file is created using the makealiases
program. The syntax makealiases
is as follows:
makealiases -src=srcfile -tmp=tmpfile -auxtmp=auxtmpfile \ [ -alias=aliasfile ] [-dump] [module]The
src
, tmp
, and auxtmp
parameters must be
specified. Either the alias
parameter or the dump
flag must
be specified.
srcfile is a text file with alias definitions. makealiases
uses two temporary files to create the aliases.dat
file. You must
specify the names of those files using the tmp
and auxtmp
parameters. aliasfile is the complete pathname to the final
aliases.dat
file, which should be either in the lib
directory, or in the MODULE
directory. tmpfile and
auxtmpfile must be on the same filesystem as aliasfile.
You may not have more than one instance of makealiases
running at
the same time, using the same temporary files. makealiases
automatically removes the temporary files when done.
It is safe to run makealiases
while Courier is running. The new
aliases.dat
file takes effect immediately.
All E-mail addresses in srcfile are rewritten to the canonical
format. The optional module
parameter specifies the module whose
rewriting functions are used. If not specified, it defaults to local
,
so that you can specify addresses in srcfile without your local domain
name.
The -dump
flag prevents the alias file from being created.
Instead, makealiases
just rewrites all the addresses, removes the
duplicates, and displays the final alias list on standard output.
srcfile can be set to "-". makealiases
will read alias
specifications from standard input.
An alias specification takes the form of:
alias: address1, address2, address3 ...
This specifies an alias whose name is alias. Mail that's sent to alias will be delivered to the specified list of addresses instead.
Instead of specifying an address, another alias can be used in its place, inserting the contents of the second alias list into the first alias list.
An alias specification may use mutiple lines. Start the second line with a tab character, or a space. For example:
everyone: john, steve, mary, alice, tom, harry, geneFor example, here's a three person organization. Gloria is in Sales, Steve is a system administrator, John does both sales and system administrators:
sales: john, gloria
sysadmin: steve, john
everyone: sales, sysadmin
This alias file specifies that mail addressed to 'sales
', will be
delivered to the john and gloria accounts. Mail sent to 'sysadmin
'
will be delivered to to the steve
and john
accounts. Mail
sent to 'everyone
' will be delievered to steve
,
john
, and gloria
. Although john
is listed twice in
the everyone
alias - once in the sales
alias, and the second
time in the sysadmin
alias - john
will receive only one copy
of the message. The makealiases
command (and the submit
command also), automatically eliminates duplicates. Running makealiases with
the -dump flag results in the following output.
everyone@example.com: john@example.com, gloria@example.com, steve@example.com
sysadmin@example.com: steve@example.com, john@example.com
sales@example.com: john@example.com, gloria@example.com
In this example, the local domain is '@example.com
'. The makealiases
commands automatically converts all addresses to the canonical format.
The company grows in size, and it is now necessary for someone to be available 24 hours a day. Steve volunteers, and the following change is made:
sales: john, gloria
sysadmin: steve, john
everyone: sales, sysadmin
steve: steve, steve@domain.com
All mail sent to steve
will now have a second copy mailed to
steve@domain.com
, IN ADDITION to being delivered to the local
mailbox. steve@domain.com
is Steve's Internet account at home. This
changes affects all mail sent to steve
, not just to mail sent to one
of the defined aliases. Running makealiases
with -dump
now
results in the following output:
everyone@example.com: john@example.com, gloria@example.com, steve@example.com, steve@domain.com steve@example.com: steve@example.com, steve@domain.com sysadmin@example.com: steve@example.com, john@example.com, steve@domain.com sales@example.com: john@example.com, gloria@example.comThis kind of forwarding should really be implemented in the
.courier
delivery specification file in Steve's account. Although allowed, aliases
should never have the same name as a local account. Typically, you should
define aliases for postmaster
, and mailer-daemon
.
-dump
flag-dump
flag's output give an indication of
what makealiases
does:
RW_RECIPIENT
).
makealiases
consists of all alias references resolved, so
the contents of all the defined aliases is just the end list of addresses.
-dump
flag can be reread by makealiases (it's pretty safe to assume that if addresses are
already in canonical format, the rewrite function does nothing). Note
that some information is lost - namely if a list of addresses in an alias
actually came from another alias.
-dump
flag is completely
random.
-dump
may list the alias in
parts.
aliases.dat
filealiases.dat
file is a GDBM (or a DB) database. Unless the list of
addresses in a single alias is large, the layout is pretty basic. The GDBM/DB
database is keyed by the alias name, and the contents of the record are the
addresses defined by the alias. Each address is followed by a newline
character.
In order to prevent the GDBM/DB library from consuming excessive amounts of memory, if an alias defines a large list of addresses, the list is saved in multiple records. The key of the second record is the alias name, followed by a newline, followed by "1". If a third record is necessary, it's name is the alias name, followed by a newline, followed by a "2". And so on.
/etc/aliases
fileAlthough Courier's implementation of aliases.dat
may seem very
similar to sendmail's /etc/aliases
file, there are some important
differences:
aliases.dat
file. To deliver mail to a command, or append it to a
file, set aside a system mailbox, or a Qmail-style alias account, then create
an appropriate .courier
file.
foo: \foo, bar
" syntax is made redundant. Just use "foo:
foo, bar
".
makealiases
in
order for the address rewriting changes to become effective.