Howto Forward/Redirect Emails
Say you want to forward your BIC email to other accounts out there. Here’s the recipe:
- Create a file at the top of your BIC home directory,
~/.forwardwith permissionsrw-,---,---(ie use the commandchmod 600 ~/.forward). - If your username is
jane, then the forward file should be located in/home/bic/jane/.forward. NOTE THE DOT IN THE FILENAME.
The mail server will refuse to use a ~/.forward if it is write-enabled by others than you — a security feature.
- With you favorite editor (nano, pico, gedit, vi, etc….) insert the email addresses that you want to forward to, either one by line:
a@foo.com b@bar.org c@blah.net
or, all on one line with addresses delimited by commas ‘,’ like
a@foo.com, b@bar.org, c@blah.net
- You can also simply use the command
echo jane@other.net > ~/.forward. Beware: this will clobber any pre-existing~/.forward. - If you preprend a forwarded address with a backslash “ ” no further forwarding is done, ie the email is delivered locally. Useful to avoid mail loops…
- You can also use
procmail, a program to process emails (seeman procmailrcandman procmailexfor examples). The syntax is more complicated but allows to do complex tasks. Note that your~/.forwardwill be disregarded if you create a~/.procmailrcfile withprocmailrecipes in it. - An example of a
procmailrecipe that does the same as the above~/.forward:
:0:
{
! a@foo.com
! b@bar.org
! c@blah.net
}
