[ Classic Linux. ]
To use the
procmail program to filter incoming mail in a Classic Linux environment,
simply create a file called
.procmailrc within your home directory.
Do not add any procmail-related command into a
.forward file as some websites
may recommend. All mail delivery is already done by
procmail , so a
file in your home directory is all that you need.
.procmailrc file, the symbol
ORGMAIL will be automatically already
~/Maildir/. and will cause normal mail delivery into the
Maildir directory, where mail can be accessed via IMAP, POP, and webmail, as described elsewhere.
Due to the many complexities of
.procmailrc files, it's highly recommended that you
consult many tutorials that can be found on the Internet, and be very cautious, to avoid losing mail.
Avoid bouncing mail. Older procmail recipes on the Internet sometimes make procmail exit with a 67 exit code, which is supposed to bounce mail back to the sender. This is a bad idea, because it creates backscatter. Instead of bouncing unwanted mail, just discard it by writing it to /dev/null.
You can find a minimal simplified
.procmailrc file for forwarding mail to an off-site address on this page: Example .procmailrc file for mail forwarding.
An longer and more generic
.procmailrc file can be found on this page: Example generic .procmailrc file.
In normal use, most people will enable logging to a log file. The log file will grow endlessly unless you take steps to prune it. This can be easily done automatically using the logrotate program, which can be run once a day from a cron job. Details are described on the page Logrotate for pruning log files.