Redistributing Messages: rcvdist
[previous]
[next]
[table of contents] [index]
If you receive messages that should be sent to other people, use
rcvdist.
It does the same thing as the MH
dist command.
rcvdist adds a Resent-...: field, with one or more new
addresses, to the message -- then resends the message.
Here are some ways to use rcvdist:
-
While you're out of your office, reroute some messages to other people.
Or maybe you're training someone else to do your job and you'd like
them to get duplicates of some of your mail.
(To route all of your
mail to someone else, put that person's address in your .forward
file -- if your system supports .forward, that is.)
-
If you get certain messages that are sent regularly or automatically, and you'd
like other people (coworkers, subordinates, or anyone) to see those
messages too, use rcvdist to do it automatically.
-
Maybe you're on a mailing list that's sent from a distant computer
site, and other people in your company would like copies of the
messages, too.
The long-distance network might be used more efficiently if the mailing
list messages are sent only to you -- then you run rcvdist to
redistribute the messages to people on other computers in your company.
(If you aren't sure, your system's postmaster can help you decide.)
To run rcvdist from your .maildelivery file, give the
address or addresses as arguments.
For example, to redistribute mh-users-request mail (see the
Section First .maildelivery Argument: Field)
to lisa and ed@foo.com, use:
source mh-users-request ^ R "/x/y/rcvdist lisa ed@foo.com"
Try not to use any spaces within an address.
If you have to do it, remember to put escaped double quotes
(\") around that address:
from root ^ R "/x/y/rcvdist \"The Guru <om@mt.top.com>\""
Unless you need to use the pipe or | action, it's much
better to use the qpipe or ^ action.
That way, if your addresses are single words with no space in them,
you won't have to worry about shell quoting.
For instance, the entry below works fine with qpipe (^) -- but
it doesn't work with pipe (|) because the shell would
interpret < and > as redirection characters:
to managers ^ R "/x/y/rcvdist <jane> <al@fbar.com>"
If you have to use special characters and the pipe or
| action, protect the addresses with single quotes (')
or escaped double quotes (\").
For more about quoting, check UNIX Power Tools or any good shell
programming book in the Reference List.
By default, rcvdist adds the following field to the message header
before resending it:
Resent-Fcc: outbox
That field drops a copy of the redistributed message into your folder
named outbox.
(See the Section Fcc: Folder Copies.)
You don't have an outbox folder, you say?
You will after you run rcvdist.
The folder copy is made by the default rcvdistcomps file.
Your system administrator may have modified rcvdistcomps, so
things may be different on your system.
If you want folder copies to go to another folder, or no folder
copies at all, you can make your own
rcvdistcomps file.
Every so often, you might remove old folder copies made by rcvdist.
One way to do that automatically is by modifying the rm_msgs
scripts in the Section
Remove Messages from rmmer.
The scripts could clean up your outbox folder as well as the
DELETE folders they're designed for.
When you redistribute a message to another address,
make sure that address won't send the same message back to you.
If it does, then rcvdist could start an infinite loop.
For example, let's say you're one of the people on the system alias called
managers.
You want to reroute all status reports to the other managers automatically.
Don't do it this way:
subject "status report" ^ R "/x/y/rcvdist managers" ...wrong
Unless your system mailer is smart enough to catch problems like
this, rcvdist will send your message to managers, that
alias will route the message back to you, rcvdist will send it
to managers again, and so on...
(If a loop starts, you can stop it pronto by editing your
.maildelivery file and adding a hash mark (#) at
the start of the entry with the rcvdist command.)
The best fix is to replace managers in that rcvdist
command line with all the managers' addresses except yours.
But that can fix be tough to do if the members of managers change
often -- or if the alias is on another computer and you can't find out
what addresses are on it.
A workaround: make your own
rcvdistcomps file
-- you might name it rcvdistcomps.noloop.
The file should add a special comment field to the message
rcvdist resends:
Resent-comments: noloop
(There's nothing special about the word noloop; you can use any word.)
Next, in your .maildelivery file, on the entry before
rcvdist, add an entry that will destroy messages with that
special field.
Be sure that the rcvdist entry uses the ? (question mark)
action so it won't be executed if the previous destroy succeeds:
resent-comments,noloop,destroy,A,-
subject,"status report",^,?,"/x/y/rcvdist -form rcvdistcomps.noloop managers"
How does it work?
The first time a status report comes in, rcvdist will add your new
Resent-comments: noloop field and send the message to
managers.
When the message comes back from managers to you, though,
.maildelivery will match that special field -- and destroy
the message before rcvdist can send it again.
A dirty fix?
Maybe.
But, at least, it's a good demonstration of how these mhook
utilities can be combined.
|