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,
~/.forward
with 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 procmailrc
andman procmailex
for examples). The syntax is more complicated but allows to do complex tasks. Note that your~/.forward
will be disregarded if you create a~/.procmailrc
file withprocmail
recipes in it. - An example of a
procmail
recipe that does the same as the above~/.forward
:
:0: { ! a@foo.com ! b@bar.org ! c@blah.net }