User Tools

Site Tools


hints:procmail_classic_linux

Procmail mail filtering in Classic Linux

[ 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 .procmailrc file in your home directory is all that you need.

Mail delivery in Classic Linux is always done into a directory called Maildir in your home directory. This directory is essentially a mailbox in maildir format.

Inside any .procmailrc file, the symbol ORGMAIL will be automatically already defined as Maildir/. or ~/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.



hints/procmail_classic_linux.txt · Last modified: 2021/02/25 20:01 by admin