.TH .forward "" "" "System Administration"
.PC "Set a forwarding address for mail"
.PP
The file
.B $HOME/.forward
lets you automatically redirect your incoming mail.
You can redirect mail to one or more other users, who are located either
on your local machine or on a remote site; or you can redirect your mail
to one or more programs on your local machine, for further processing;
or both.
As you can see, this feature of the mail system included with \*(CO
gives you great flexibility in processing your mail.
.PP
For example, you may wish to forward to another user any mail that is
sent to the superuser root, so you can handle it immediately.
(If you don't, it will languish in
.BR root 's
mailbox until someone logs in as
.BR root ,
which may not happen for days.)
To forward
.BR root 's
mail to user
.BR fred ,
place the following line into file
.BR /.forward :
.DM
	fred
.DE
.PP
Thereafter, whenever mail is sent to
.BR root ,
it will be forwarded automatically to user
.BR fred .
.PP
For another example, suppose that you are going on vacation, and you want your
mail to be forwarded both to user
.B fred
and to user
.BR anne .
To do so, insert the following instruction into file
.BR $HOME/.forward :
.DM
	fred, anne
.DE
.PP
Thereafter, the route-mail program
.B rmail
will send a copy of every mail message you receive to
.B fred
and to
.BR anne .
Please note that
.B rmail
will
.I not
insert a copy into your mailbox:
if you forward your mail, you will not see it.
.PP
For another example, suppose that user
.B fred
has an account on each of two systems:
one called
.B acme.com
and the other
.BR zenith.com .
Suppose, further, that he logs into
.B acme.com
regularly, but he logs into
.B zenith.com
only now and again.
This user probably would want to route any mail he receives on
.B zenith.com
to
.BR acme.com ,
so he will see it immediately.
To do so, he would put the following instruction into file
.B $HOME/.forward
on
.BR zenith.com :
.DM
	fred@acme.com
.DE
.PP
Thereafter, all mail sent to address
.B fred@zenith.com
will be forwarded automatically to
.BR fred@acme.com .
.PP
Please note that it is illegal to include in \fB.forward\fR the name of the
user whose mail is being forwarded, because it causes an infinite loop in the
mail system.
For example, writing
.DM
	fred, anne, root
.DE
.PP
into
.BR root 's
.B .forward
file causes any message sent to
.B root
to be forwarded to
.BR fred ,
.BR anne ,
and
.BR root ;
the copy forwarded to
.B root
is again forwarded to
.BR fred ,
.BR anne ,
and
.BR root ;
and so on, \fIad infinitum\fR.
.PP
You can also embed the name of a program with your
.B .forward
file.
All mail sent to your account will be handed to this program for processing.
For example, the
.B elm
mailer includes a program called
.BR filter ,
which a user can program to read his mail and throw away unwanted messages.
If you have installed
.B elm
onto your system, you can turn on
.B filter
by embedding the following command into file
.BR $HOME/.forward :
.DM
	"|/usr/local/bin/filter"
.DE
.PP
Note that the command must be preceded by a `|' symbol; this is because
.B filter
receives its input from the standard input, which is the standard method
for programs that filter text or mail.
Note, too, that the entire command must be enclosed within quotation marks.
.SH "See Also"
.Xr "Administering COHERENT," administe
.Xr "mail [overview]," mail.o
.Xr "smail" smail
