Mail forwarding using .forward files

Why and where to create .forward files

Generally there are two methods of mail forwarding that are relevant to ACMS account holders. One is using .forward files and the other involves specifying a destination for mail sent to your name@UCSD.EDU address. They have different advantages and limitations.

Setting up .forward files is particularly useful in situations where you have more than one account on ACMS systems or your account exists on more than one mail server and you want to direct all your mail to one account on one server. Place identical .forward files in all your accounts, except for the account in which you intend to read mail (the account the .forward file points to).

While you can also use .forward files to direct your mail from ACMS accounts to an off campus mail address, for example to an AOL account, you need to be aware of the following limitation.

Important: .forward files are NOT functional on accounts which have been suspended or deactivated. So for example if you withdraw from school for a quarter and your account is suspended because you are not enrolled, a .forward file will have no effect.

Creating a .forward file

Login to Unix to create a .forward file in your homedirectory. This file should contain, as the first and only line, the address where the mail should be forwarded.

For example, "pyi@emperor.ucsd.edu". You can create the .forward file with your favorite text editor, or you can create it with an echo command like this:

echo 'pyi@emperor.ucsd.edu' > .forward

This will send the line "pyi@emperor.ucsd.edu" into the file called .forward, thus creating a .forward file for you. As long as this file exists in your account space, all mail sent to this account will automatically go to pyi@emperor.ucsd.edu.

Using a .forward to send mail to multiple accounts

If you put multiple addresses in a .forward file, a copy will be sent to each.

amidala@sdcc10.ucsd.edu, jbinks@ieng9.ucsd.edu, askywalk@iacs5.ucsd.edu

Such a setup might be useful for accounts belonging to student organizations. Mail sent to that account could automatically be forwarded to the officers of the club at their respective addresses.

If you want to keep a copy of each message in the original account without causing a .forward infinite loop, put a backslash in front of the account name. It's best to use a text editor for this. Otherwise you need to use special syntax to put a backslash in the .forward file.

\starwars, amidala@sdcc10.ucsd.edu, jbinks@ieng9.ucsd.edu, askywalk@iacs5.ucsd.edu

Warnings about mail loops

You must make sure to avoid creating loops in the mail transmission flow. If you create a .forward file that points to itself (or points to a .forward file that points back to the first one, creating a ping-pong effect), you obviously will not recieve the mail.

Don't do this.

\starwars, "|mail dvader"

The intention here is to retain a copy for yourself AND mail a duplicate to the dvader account. At first this method appears to work okay, however if there is any type of problem delivering to dvader, the returned mail will keep bouncing and growing indefinitely.

Again, the proper way to do it is:

\starwars, dvader
For more complex forwarding and filtering, the procmail program can be used.