| ForwardingMailToGmail |
UserPreferences |
| cornerhost wiki | FrontPage | RecentChanges | TitleIndex | WordIndex | SiteNavigation | HelpContents | moin.sf.net |
Please don't forward your mail to gmail. (Any spam you forward will look like it's coming from cornerhost, and may get us blacklisted.)
Instead: CheckMailFromGmail.
If you must forward your mail, you can use procmail. But please filter out the spam through SpamAssassin first. ( see FAQ/SpamAssassin )
Forwarding is a fairly easy thing to do with procmail, however there is one catch. Occasionally, google will reject or bounce a message - if it contains a virus, for example. When this happens you want to make sure that you don't forward the bounce back to them, because it creates an infinite loop.
The trick is to add an X-Loop header, and then not deal with messages that already have that header. Gmail currently doesn't do this on it's end, so the responsibility is with us.
It looks like this in your ~/.procmailrc file:
# your remote address
WHERETO=xyz@gmail.com
# uncomment next two lines for debugging
#LOGFILE=$HOME/procmail.log
#VERBOSE=yes
# you need to set a shell to use formail
SHELL=/bin/sh
## filter spam FIRST! #####
:0fw
| spamc
:0:
* ^X-Spam-Status: Yes
/dev/null
## do the forwarding #####
:0c
* !^FROM_DAEMON
* !^FROM_MAILER
* !^X-Loop: to_gmail
| (formail -t -I"To: $WHERETO" \
-A"X-Loop: to_gmail" \
) | $SENDMAIL -t