setforward writes the forwarding database to tmp; it then moves tmp to cdb. tmp and cdb must be on the same filesystem.
If there is a problem creating tmp, setforward complains and leaves cdb alone.
The forwarding database format is portable across machines.
For example,
root@yp.to: god@heaven.af.mil, staff@af.mil;
says that mail for root@yp.to should be forwarded to the recipient addresses god@heaven.af.mil and staff@af.mil.
When setforward sees # it ignores all text from # to the end of the line:
# this is a comment
setforward ignores all other line endings, so you can split a forwarding instruction across lines. It also ignores spaces and tabs. Exception: you can put a space (or tab or comma or whatever) into a target or command by putting a backslash in front of it. (However, NUL bytes are not permitted anywhere.)
All the commands for a single target must be listed in a single instruction. Exception: an owner address can be listed in a separate instruction.
boss@yp.to: &god@heaven.af.mil;
fastforward sends each incoming mail message to the recipient address. The recipient address must include a fully qualified domain name. It cannot be longer than 800 bytes.
If a recipient address is itself a target in the forwarding table, fastforward will recursively handle the instructions for that target. Note that @host.dom and user@ wildcards do not apply here; they apply only to the incoming address.
If a command begins with a letter or number, setforward takes the entire command as a recipient address:
boss@yp.to: god@heaven.af.mil;
sos@heaven.af.mil: ?owner-sos@heaven.af.mil;
fastforward uses that address as the envelope sender for forwarded mail, so bounces will go back to that address. (Normally, if a message is forwarded to a bad address, it will bounce back to the original envelope sender.)
sos@heaven.af.mil: /etc/lists/sos.bin;
fastforward will read and obey the commands in that file. The file must be world-readable and accessible to fastforward.
dew@: |dew-monitor;
For a vertical bar, fastforward feeds the message to that program. An exclamation point works the same way except that fastforward inserts $UFLINE, $RPLINE, and $DTLINE in front of the message.
everybody@yp.to: programmers@yp.to, testers@yp.to;
programmers@yp.to: joe@yp.to, bob@yp.to;
testers@yp.to: joe@yp.to, fred@yp.to;
A message to everybody@yp.to will be sent to joe@yp.to only once. (This also means that addresses in an internal forwarding loop are discarded.)
Exception: If a target has an owner address, commands for that target are considered different from commands for ``outside'' targets.