mail foward

Automatically forward emails

If you want to forward all new emails to a different email address, you just have to do so directly in the
create a file called .forward in your own home directory. In this file you only write the email
Address to which newly arriving emails should be forwarded (emails already received will be forwarded
not forwarded). To be on the safe side, you can generate a local copy on the RBI server by
preceded by a line with your own login name. However, the login name must be preceded by a backslash \
be! Otherwise you create an email loop!

Example of a .forward file:

\my_loginname
user@remote.host.de

However, this method of email forwarding has the disadvantage that all spam emails are also forwarded.
In this case, some email providers not only filter out spam, but also block the sender of the spam emails.
in this case the email address of the RBI account from which the forwarding was made. We therefore recommend
e.g. to use procmail to filter spam before forwarding.

Recommended: Automatically forward emails and filter spam


A better variant is to use the forward file together with the procmail program. In addition
create a forward file .forward and a. using an editor such as vim, nano, xemacs, nedit...
Control file .procmailrc in your own home directory (cd ~) with the following content:

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

.forward

"|IFS=' ' && exec /usr/bin/procmail -f- || exit 75 #lyour_loginname"

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

.procmailrc

MAILDIR=$HOME/Mail
SPAMFILE=$MAILDIR/Junk
# to delete, set SPAMFILEHW=/dev/null
SPAMFILEHW=$MAILDIR/JunkHW

 

# You can delete the following two lines after a successful test.
#Otherwise you will have to delete the log file from time to time.
LOGFILE=$HOME/procmail.log
LOGA ABSTRACT=yes

# Filter out spam emails with 8 or more asterisks
# Probability of misdirection = 0.05%
:0H:
* ^X spam level: \*\*\*\*\*\*\*\*\*\*
$SPAMFILEHW

# Filter out spam emails
# X-Spam-Flag=YES from 5 stars, otherwise =NO
:0H:
* ^X spam flag:.*YES
$SPAMFILE

# If you only want to filter out spam emails, delete the next lines
# redirect
# Replace user@remote.host.de with the desired destination address
# The c causes a copy to be placed on the local server
:0 c
! user@remote.host.de

-------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -

The spam emails are then saved in the file ~/Mail/Junk. Please make sure that
Directory Mail exists in your home directory (otherwise create it with the mkdir Mail command).
Please note that a small proportion of emails that are not spam can be accidentally rated as spam
Spam emails are. That's why you shouldn't delete spam emails automatically, but rather from time to time
View all emails in the Junk file and filter out misdirected emails.