The term aliasing refers to substituting one or more addresses for another address. A one-to-one substitution results in the Courier mail server accepting mail for one address, and delivering the mail to another address. A one-to-many substitution results in the Courier mail server accepting mail for one address, and delivering a separate copy of the message to every address defined by the alias.
/etc/courier/aliases.dat is a binary database file. makealiases creates the binary database file by reading the aliases from plain text files, and makealiases creates /etc/courier/aliases.dat by default.
makealiases creates /etc/courier/aliases.dat from one or more source files, which are plain text files that may be created by any text editor. The format of those source files is defined below. By default, makealiases obtains the source text from /etc/courier/aliases. If this is a text file, it is used verbatim. If this is a directory (the Courier mail server creates it as a directory by default), all the non-hidden files in this directory are concatenated together.
The optional module specifies the module whose rewriting rules are used to convert E-mail addresses into a canonical form. If not specified, the local module's address rewriting rules will be used.
Addresses in /etc/courier/aliases.dat will be checked in every message. Use the -protocol option to create aliases that will be checked only for message that are received via a specific protocol, such as ESMTP, UUCP, or locally-generated mail. This allows you, for example, to create an alias such as "everyone", which is only avaliable to locally generated mail, and does not work for mail received via ESMTP. The argument to the -protocol option is one of: esmtp, uucp, or local.
Protocol-specific alias files are /etc/courier/aliases-protocol.dat, where "protocol" is the specific protocol, such as "local", "esmtp", or "uucp", and the source file read by makealiases would be /etc/courier/aliases-protocol. If the -protocol option is specified, makealiases will access these files instead of /etc/courier/aliases.dat and /etc/courier/aliases.
The sources file used to create the binary aliases.dat database are plain text files that may be created using any editor.
Each alias specification takes the following form:
alias: address1, address2, ...
Mail received by the Courier mail server addressed to alias will be delivered to the list of addresses specified. The list of addresses may be split across multiple lines, if the second and subsequent line starts with a space character.
Lines starting with the # character are ignored, they are comments.
alias is not restricted to be a local address. It may be any valid m[blue]RFC 2822m address. All addresses do not necessary have to be in a canonical form.
This notation reads the list of addresses from another file, /absolute/pathname. This file should contain one address per line (comma separated addresses on the same line will also work).
If alias refers to a local, existing, account, this account will never get any mail. Any mail with the account listed as recipient will be redirected to all the addresses specified for that alias. To have a copy of the mail delivered to the account, define it as one of the addresses in the alias itself. For example:
larry: larry, moe, curly, shemp
Larry will still receive his mail, but copies will will also be sent to Moe, Curly, and Shemp. If Larry wasn't specified in the alias, he would never get any mail, it will all be forwarded to Moe, Curly, and Shemp.
Alias definitions may refer to other alias definitions, and makealiases automatically incorporates addresses from other aliases. If the same address is listed in multiple aliases, and two or more of them are specified as recipients of the same message, only one copy of the message will be delivered to the address.
The following special syntax implements a virtual domain. A virtual domain redirects all mail for an entire domain to one user:
This special entry results in any recipient address of the form foo@domain to be rewritten as user-foo@me, where me is the hostname of the machine, which we expect to be a local domain.
The following examples use the alias entry "@example.com: john", and "domain.com" is in the control/me file. The address "email@example.com" becomes "firstname.lastname@example.org", and "email@example.com" becomes "firstname.lastname@example.org".
The intended behavior is to use an actual account named john. As a result of the virtual domain address rewriting, delivery instructions for email@example.com can now be specified by john's $HOME/.courier-postmaster file, and delivery instructions for firstname.lastname@example.org may be specified by $HOME/.courier-sales-info. john's $HOME/.courier-default may be used to specify delivery instructions for any other address in the example.com domain, which does not have an explicit .courier file.
If the alias entry was "@example.com: john-example", the corresponding files in john's $HOME directory are .courier-example-postmaster, .courier-example-sales-info, and .courier-example-default. See m[blue]dot-courier(5)m for more information on .courier files.
Virtual domain rewriting is NOT recursive, unlike regular aliases. For example:
tom: email@example.com @example.com: larry
You should explicitly expand the alias out:
The following notation associates an address directly with a mailbox, or with a program:
Messages addressed to "info" will be delivered to the mailbox or maildir /var/shared/info. A full pathname must be specified.
info: | /usr/local/shared/info
Mail addressed to "info" will be delivered to the indicated program. The program receives each message on standard input.
Program/mailbox delivery notation is primarily used to support legacy sendmail aliases entries. This is considered to be a legacy feature, and new installations should create a m[blue]dot-courier(5)m file with the necessary delivery instructions. In fact, aliases for programs or mailboxes is not directly supported by the Courier mail server's aliasing mechanisms. It's implemented by having the makealiases script automatically create a .courier file, and point the alias address to it.
See m[blue]dot-courier(5)m for more information.
Unlike sendmail, the Courier mail server delivers as user "daemon" (group daemon) when delivering to programs or mailboxes.
The following notation allows mail addressed to a certain domain to be forwarded via uucp:
The trailing ! tells the Courier mail server not to append a dash, so user@domain gets rewritten as uucp!bang!path!user, and not uucp!bang!path-user, which is probably not what you want.
An alias with only one address does not affect delivery status notification attributes of an E-mail message.
An alias with multiple addresses is treated like a private mailing list, as defined by m[blue]RFC 1894m. If the message requests a successful delivery notification, the Courier mail server generates a delivery status notification for the successful delivery to the aliased address, and each alias recipient address will have DSNs set to NEVER.
This has nothing to do with the Courier mail server's support for a Qmail-style alias account.
owner-foo feature of sendmail's aliasing is not supported.
the Courier mail server normally tries to eliminate duplicate addresses listed as recipients for the same message. Some mail servers are not capable of delivering messages with multiple recipients, and will transmit a separate copy of the same message addressed to each recipient. The Courier mail server can't do anything in this case. Each copy of the same original text is considered an individual, separate, message.
Duplicate elimination can fail in certain rare circumstances, involving exotic features of m[blue]RFC 2822m concerning case sensitivity.
"@example.com: jack, jill" is allowed, but strongly discouraged under the penalty of law.
Because multiple-recipient aliases are treated like private mailing lists, failure DSNs are turned off, and a bad recipient address is hardly noticed by anyone.
The makealiases command may execute while the Courier mail server is running, and any changes take effect immediately. However, only one instance of makealiases is permitted to run at the same time.