DOT-FORWARD(1)

NAME
dot-forward, dotforward - Read $HOME/.forward

SYNOPSIS

$ cat $HOME/.courier
|| dotforward
./Maildir

DESCRIPTION

The dotforward program is a compatibility module that reads forwarding instructions in $HOME/.forward. dotforward is used for compatibility with sendmail or other mail servers that use the $HOME/.forward file. The dotforward program is intended to be executed from a dot-courier(5)[1] delivery instruction file. The system administrator can add it to the default set of delivery instructions, thus unilaterally implementing $HOME/.forward systemwide. To read forwarding instructions from $HOME/.forward, put "|| dotforward" on the first line of $HOME/.courier*. "|| dotforward" can also be added to the DEFAULTDELIVERY setting in the courierd configuration file. In both cases it must be followed by a newline, and the remaining delivery instructions, which will be used if $HOME/.forward does not exist.

dotforward expects to be invoked from dot-courier(5)[1] delivery instruction file via the "||" operator (or from DEFAULTDELIVERY). dotforward checks its environment, reads the message from standard input, reconciles its environment with the contents of $HOME/.forward, then prints on standard output equivalent dot-courier(5)[1] compatible delivery instructions. The "||" operator reinterprets dotforward's output as additional delivery instructions, by the Courier mail server.

The different security models of the Courier mail server and other mail servers that use $HOME/.forward, such as sendmail, means that it is not possible to faithfully duplicate 100% of the behavior of $HOME/.forward that originated with sendmail. The following section documents the behavior of the dotforward utility in the the Courier mail server mail server.

  $HOME/.forward processing

dotforward reads the DTLINE environment variable, and the headers of the message being delivered, from standard input. DTLINE contains the recipient's E-mail address. The Delivered-To headers list the recipients that already received this message. This is used to prevent mail loops between $HOME/.forward files from different recipients, which forward mail to each other.

If $HOME/.forward does not exist, dotforward quietly terminates with a zero exit code, doing nothing. The remaining delivery instructions in $HOME/.courier are then carried out.

If $HOME/.forward exists, it is expected to contain a list of addresses that the message should be forwarded to. An address may be an actual E-mail address, or a name of a program or a mailbox. Each line in $HOME/.forward should contain a list of comma-separated addresses. Use "| /path/to/program" (including the double quotes) to specify a delivery to a program (the message is piped to the given program). Use "/path/to/mailbox" or "./path/to/mailbox" (again including the double quotes) to specify a delivery to a mailbox (relative to $HOME in the second case).

"| /path/to/program", "/path/to/mailbox", and "./path/to/mailbox" may also be listed on a line by themselves without the double quotes.

All other addresses are interpreted as E-mail addresses where the mail should be forwarded. Any backslash at the beginning of an E-mail address is removed. Backslashes are used by sendmail to prevent mail loops. The Courier mail server does not need the backslashes -- it uses a different mechanism to prevent mail loops.

Every E-mail address is checked against the list of E-mail addresses found in Delivered-To headers. If the E-mail address specified in $HOME/.forward matches any address in the Delivered-To header, it is automatically removed from a list of addresses.

dotforward normally terminates with the exit code set to 99. This results in the Courier mail server considering the message to be succesfully delivered, and any additional delivery instructions in the .courier file will not be carried out. If an address read from $HOME/.forward matches the address in the DTLINE environment variable, the address is removed from the list of addresses that the message will be forwarded to, and dotforward terminates with the exit code set to 0 (after printing all the relevant delivery instructions to standard output). The messages will be forwarded, and the Courier mail server will proceed with additional delivery instructions in the .courier after finishing with the delivery instructions it reads from dotforward.

BUGS

The restrictions and precautions mentioned in dot-courier(5)[1] are also applicable here. There is an upper limit on the maximum number of characters that are read from any process executed by ||. Also if any delivery instruction fails with a transit exit code, the message will be completely redelivered at a later point, even to all the addresses it has been succesfully delivered the first time around.

SEE ALSO

dot-courier(5)[1].

AUTHOR

Sam Varshavchik
    Author

NOTES

1.  dot-courier(5)
    http://www.courier-mta.org/dot-courier.html