
186
|
Chapter 8, Desktop Programs
#58 Reclaim Your Email with procmail
HACK
Along with the many different MTAs available are many different ways to
configure them to use procmail. Despite the mass of potential options, an
almost foolproof method is to use a .forward file in your home directory.
This file contains rules that, when followed, invoke procmail for all incom-
ing mail. The following command enables procmail for most MTAs:
foo@bar:~$ echo '|exec /usr/bin/procmail' > ~/.forward
If your MTA complains, you might have to use just |/usr/bin/procmail
instead.
Using procmail
procmail rules, better known as recipes, are defined in the .procmailrc file in
your home directory. Although a full treatment of the recipe syntax is
beyond the scope of this hack, a simple example shows the basic format.
Add the following to your .procmailrc file:
:0
*
This simple recipe delivers all mail addressed to you to your default system
mailbox file (usually /var/mail/$USER). The
:0 indicates the beginning of a
rule and the
* indicates that all mail should be handled by this rule. This re-
creates what your MTA usually does by default. If you use the maildir for-
mat (the preferred format of the qmail MTA and the KMail client), procmail
can move all mail to a directory with a recipe, such as this:
:0
*
Mail/
This delivers your mail into a maildir-formatted directory ($HOME/Mail by
default). If you prefer standard mailbox format ...