Mail forwarding
Juergen Wagner
gandalf at csli.STANFORD.EDU
Wed Jun 8 02:55:46 AEST 1988
In article <891 at dsacg3.UUCP> ntm1458 at dsacg3.UUCP (John Darby) writes:
>
> My .forward file looks like this:
> hostname\!myid
...stuff deleted...
>John T. Darby, (DLA Systems Automation Center, DSAC-TMM, P.O. Box 1605
Ok. That's fine. I believe, the original question was how to redirect
incoming mail to both, a program and the mailbox. The above solution
only forwards mail to another machine. A few comments on that:
o The syntax user at host is preferrable and should be understandable
for all mailers.
o You should even keep a .forward on the machine you're reading your
mail on because if you have a couple of machines hooked up over
NFS, your home directory may always be the same (i.e. also your
.forward). Say, you have machines "foo" and "bar" sharing the NFS
file system on which your common home directory resides. Sending
mail to either one will stay on that machine. Having a "global"
.forward will forward it to one machine. You could, of course, also
use a pipe to store incoming mail in a file accessible from both
machines.
o The .forward actually contains a list of paths to forward mail to.
It contains a comma-separated list of addresses or pipes. Using a
.forward
gandalf at csli.stanford.edu, gandalf at portia.stanford.edu
will NOT cause mail looping on csli because when sending mail on
host X to user Y, addresses Y at X' where X' is a name for X, are
simply ignored.
o To prevent alias expansion, you can precede the address by a backslash.
\gandalf
will directly send it to user gandalf on the local machine, and
will not try alias expansions. Other backslashes are not needed.
I believe, they are properly treated, though.
o To pipe something into a program, use the following syntax:
"|/a/gandalf/getmail gandalf"
where /a/gandalf/getmail might be a short script like
#! /bin/csh
touch /a/gandalf/post
echo "" >> /a/gandalf/post
echo "This is a message received on `date`." >> /a/gandalf/post
cat >> /a/gandalf/post
echo "--------end of message----------(to $1)" >> /a/gandalf/post
exit 0
which collect all messages into a file /a/gandalf/post (quick and
dirty). The message is read by reading standard input.
That's something about mail. If anybody has further questions, please
consult the man page "aliases, ...(4)" which describes all that in
detail. Flames to /dev/null, please.
--
Juergen "Gandalf" Wagner, gandalf at csli.stanford.edu
Center for the Study of Language and Information (CSLI), Stanford CA
More information about the Comp.unix.questions
mailing list