
Chapter 16. Email 213
a .procmailrc file in the user’s home directory to find rules specific to that user. Many users also
create additional rc files of their own for Procmail that are referred to by their .procmailrc file but
may be turned on or off quickly if a mail filtering problem develops.
By default, no system-wide rc files exist in the /etc directory, and no user .procmailrc files exist.
To begin using Procmail, you will need to construct a .procmailrc file with particular environment
variables and recipes explaining what you would like to do with certain messages.
In most configurations, the decision as to whether Procmail starts and attempts to filter your email is
based the existence of a user’s .procmailrc file. To disable Procmail, but save your work on the
.procmailrc file, move it to a similar file’s name using the mv ~/.procmailrc ~/.procmail-
rcSAVE command. When you are ready to begin testing Procmail again, change the name of the file
back to .procmailrc. Procmail will begin working again immediately.
16.5.1. Procmail Configuration
Procmail configuration files, most notably the user’s .procmailrc, contain important environmental
variables. These variables tell Procmail which messages to sort, what to do with the messages that do
not match any recipes, and so on.
These environmental variables usually appear in the .procmailrc file at the beginning, in the fol-
lowing format, each on their own line:
env-variable =" value "
Figure 16-7. Structure of an environmental variable line
In this example, the env-variable is the name of the variable, and the value section defines
the variable.
Many environment variables are not used by most Procmail users, and many of the more important
environment variables are already defined a default value. Most of the time, you will be dealing with
the following variables:
• DEFAULT — Sets the default mailbox where messages that do not match any recipes will be placed.
The default DEFAULT value is the same as $ORGMAIL.
• INCLUDERC — Specifies additional rc files containing more recipes for messages to be checked
against. This allows you to break up your Procmail recipe lists into individual files that fulfill
different roles, such as blocking spam and managing email lists, that can then be turned off or on
by using comment characters in the user’s .procmailrc file.
For example, two lines in a user’s .procmailrc file may look like this:
MAILDIR=$HOME/Msgs
INCLUDERC=$MAILDIR/lists.rc
INCLUDERC=$MAILDIR/spam.rc
Figure 16-8. Example of the INCLUDERC option in use
If the user would like to turn off the Procmail filtering of their email lists but leave spam control in
place, they could simple comment out the first INCLUDERC line with a # character.
• LOCKSLEEP — Sets the amount of time, in seconds, between attempts by Procmail to use a partic-
ular lockfile. The default is eight seconds.
• LOCKTIMEOUT — Sets the amount of time, in seconds, that must pass after a lockfile was last
modified before Procmail will assume that the lockfile is simply old and can be deleted. The default
is 1024 seconds.
• LOGFILE — The location and file to contain any Procmail informational or error messages.
Commenti su questo manuale