rewrite – mail rewrite rules|
Mail(1) uses rewrite rules to convert mail destinations into commands
used to dispose of the mail. Each line of the file is a rule.
Blank lines and lines beginning with # are ignored. |
Each rewriting rule consists of (up to) 4 strings:
In each of these fields the substring \s is replaced by the login id of the sender and the substring \l is replaced by the name of the local machine.
When delivering a message, mail starts with the first rule and
continues down the list until a pattern matches the destination
address. It then performs one of the following actions depending
on the type of the rule:
If mail(1) is called with more than one address and several addresses match | rules and result in the same expanded arg1, the message is delivered to all those addresses by a single command, composed by concatenating the common expanded arg1 and each expanded arg2. This mail bundling is performed to reduce the number of times the same message is transmitted across a network. For example, with the following rewrite rule
In the event of an error, the disposition of the mail depends
on the name of the command executing the rewrite. If the command
is called mail and is run by $user, the command will print an
error and deposit the message in /mail/box/$user/dead.letter.
If the command is called rmail, usually because
it was invoked to deliver mail arriving over the network, the
message will be returned to the sender. The returned message will
appear to have been sent by user postmaster.