setforward(1)

πŸ’Œ setforward(1) β€” bestie edition πŸ’Œ

okay so this is setforward, a general commands manual page situation, and honestly? it's giving database-builder energy. let's get into it 🫢

✨ NAME ✨

setforward β€” create a forwarding database 🌈

πŸŽ€ SYNOPSIS πŸŽ€

setforward cdb tmp

πŸ’… DESCRIPTION πŸ’…

okay so setforward reads a table of forwarding instructions from its standard input. it takes that table and converts it into a forwarding database. and that forwarding database? it can be used by fastforward. iconic teamwork fr fr ✨

setforward writes the forwarding database to tmp; then it moves tmp to cdb. and bestie, listen β€” tmp and cdb must be on the same filesystem. no cap, that's not negotiable.

if there's a problem creating tmp, setforward complains (as it should πŸ’…) and leaves cdb alone. your girl does not touch the database if things go sideways.

also the forwarding database format is portable across machines. so you can carry it around like it's your emotional support file πŸ¦‹


πŸ“ INSTRUCTION FORMAT πŸ“

a forwarding instruction has: a target, a colon, a series of commands, and a semicolon. each command is one of: a recipient address, an owner address, an external mailing list, or a program. commands get separated by commas. periodt.

for example:

root@yp.to: god@heaven.af.mil, staff@af.mil;

that says mail for root@yp.to should be forwarded to the recipient addresses god@heaven.af.mil and staff@af.mil. slay.

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 totally 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. not even one. don't do it πŸ™ˆ)


🎯 TARGETS 🎯

when fastforward sees the incoming address user@host.dom, it tries three targets: user@host.dom, @host.dom, and user@. it obeys the commands for the first target that it finds. target names are interpreted without regard to case.

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. she's special like that πŸ’…


πŸ’– RECIPIENT ADDRESSES πŸ’–

if a command begins with an ampersand, setforward takes the remaining bytes in the command as a recipient address:

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. iykyk.

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;

❓ OWNER ADDRESSES ❓

if a command begins with a question mark, setforward takes the remaining bytes in the command as an owner address:

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. so this is you taking control of the bounce situation πŸ‘‘)


πŸ“š EXTERNAL MAILING LISTS πŸ“š

if a command begins with a dot or slash, setforward takes the entire command as the name of a binary mailing list file created by setmaillist:

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. no private vibes allowed.


πŸ–₯️ PROGRAMS πŸ–₯️

if a command begins with a vertical bar or exclamation point, setforward takes the rest of the command as the name of a program to run:

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. same energy, extra lines ✨


πŸ” DUPLICATES πŸ”

when fastforward is building the recipient list for a message, it keeps track of the recipient addresses and external mailing lists it has used. if the same command shows up again, it skips it. for example:

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. so no infinite loop chaos, we love to see it πŸ™Œ)

exception: if a target has an owner address, commands for that target are considered different from commands for ``outside'' targets.


πŸ‘€ SEE ALSO πŸ‘€

newaliases(1), preline(1), printforward(1), setmaillist(1)


and that's the whole page bestie πŸ’– this was setforward(1), from the General Commands Manual β€” go forth and build your forwarding database, you absolute main character πŸŒΈπŸ¦‹πŸ’