Forwarding to an address
To forward mail to to another address, you need to place the email address of the account you want to forward to in the .forward file.- echo someone@somewhere.else > .forward (replace someone... with an email address)
The .forward file may contain multiple locations to forward your e-mail. For example, you may wish to forward mail from one account to several, or keep a copy of the mail you forward in your local account. To do this, simply add a line in your .forward for every location you wish to forward e-mail to. So, if Bob wanted to forward his mail to Mary and Joe, but also keep a copy of it, he could have a .forward that looks like this:
\bob, mary@socrates.berkeley.edu, joe@socrates.berkeley.eduThe backslash (" \ ") before Bob's address leaves a copy of the message in Bob's account as well as forwards a copy of the message to Mary and Joe.
Warning: Please take care when forwarding mail. Place the .forward file in the account you want to forward mail from containing the destination e-mail address. The destination address should NOT be the same as the source address. Also, the destination address should NOT be an address which will forward mail back to the source address. These kinds of loops cause mail to be bounced between machines and will eventually cause your mail not to be delivered.
Appending to Files
The ~/.forward file can contain the names of files onto which mail is to be appended. Such filenames must begin with a slash character that cannot be quoted. For example, if a user wishes to keep a backup copy of incoming mail:
\user /home/user/mail/in.backup
The first line (
\user
) tells sendmail to deliver directly to the user's mail spool file using the local
delivery agent. The second line tells sendmail to append a copy of the mail message to the file specified (in.backup
).
If the
SafeFileEnvironment
option is set, the user should be advised to specify the path of that safe directory:\user /arch/bob.backup here /arch was specified by the SafeFileEnvironment option
When the
SafeFileEnvironment
option is used, the cooperation of the system administration may be needed if users are to have the capability of saving mail to files via the ~/.forward file.Pipes in ~/.forward file
Any delivery agent for which the F=| flag is set can also pipe messages through programs. To disable this ability, simply remove the F=| flag from all delivery agent declarations in your configuration file.
The syntax is as follows:
|prg "|prg args" |"prg args"
http://www.softpanorama.org/Mail/pipes_in_dot_forward_file.shtml