Hints
* Top
* Top
[ Classic Linux and DirectAdmin. ]
Normal mail forwarding via a .forward
file will also forward some spam, which may be rejected by the destination site, and will bounce back to the original possibly-forged sender, causing backscatter.
This example .procmailrc
file can be used to forward mail with procmail to an off-site email address. It will try to not forward any spam.
For best results, use this in combination with ability of mail services such as Gmail and Yahoo to access your mailbox via POP.
Non-spam mail will be forwarded immediately. Some messages will not get forwarded if they appear to be spam. Any that are not forwarded will then be retrieved by the other site via POP.
Having a site retrieve your mail via POP usually causes a delay, as the polling via POP occurs every few minutes. Using procmail for forwarding eliminates this delay for almost all messages. The few messages that proccmail skips will then be pulled via POP.
# $Id: procmailrc.std.forward 13498 2021-03-01 16:41:36Z svn $ # $URL: svn+ssh://svn@svn.rahul.net/home/svn/main/trunk/stdpgm/procmailrc.std.forward $ # Minimal .procmailrc for forwarding to a different mail service, e.g., Gmail, Yahoo, etc. # # Objective: Don't forward spam, preserve original envelope sender. # Note: this log file will grow endlessly. Once forwarding is working, you should # comment out the LOGFILE line. Or you can keep logging enabled and set up # log file rollover as described on this page: # https://info.rahul.net/hints/logrotate LOGFILE=$HOME/procmail.log # verbose log, yes or no VERBOSE=no # only a precaution SHELL=/bin/sh # Required in DirectAdmin, optional in Classic Linux. ORGMAIL=Maildir/ DEFAULT=Maildir/ # Preserve original envelope sender, as recommended by Google. # https://support.google.com/mail/answer/175365 SENDER=`formail -c -x Return-Path` SENDMAILFLAGS="-oi -f $SENDER" # Forward not-spam to my off-site address, e.g., at Gmail, Yahoo, etc. :0 * !^X-Spam-Level: \*\*\*\* * !^X-Spam: Yes ! myaddress@example.com # End of minimal .procmailrc for forwarding to a different mail service, e.g., Gmail, Yahoo, etc.