Quick Procmail Setup
Procmail is an all-purpose mail filtering program. See this procmail page for more information.
Setup files and directories
Note: When a file named .procmailrc is created, the system procmail program will start working for you, so do this last. All other files and directories can be names of your choosing.First, create a procmail directory, which will contain a rules file for mail filtering rules, and a procmail log file. Then create a mail directory to hold filtered mail.
mkdir ~/.pmdir touch ~/.pmdir/log touch ~/.pmdir/rules touch ~/.procmailrcmkdir ~/mail/.inboxes touch ~/mail/.inboxes/INBOX touch ~/mail/.inboxes/work touch ~/mail/.inboxes/mac touch ~/mail/.inboxes/personal
Create Filtering Rules
Now use a text editor to enter some filtering rules.
| ~/.pmdir/rules |
|---|
# I like to keep rules in a separate file # Be careful with the regular expressions, read the man page for specifics |
Create .procmail file
This is the file that makes everything start happening, so don't create it until everything else is in place.
| ~/.procmailrc |
|---|
# Set on when debugging VERBOSE=on |
You will have to configure your mail reader to point to the new filtered mail files.
Debugging
Check the log file to see where messages are getting dumped. If you suspect procmail is messing something up, turn it off by renaming .procmailrc (and .forward if you are using it), so that procmail won't find them.
mv .procmailrc .procmailrc-testing
If the log file indicates that procmail is doing what you want it to, then turn off verbosity by editing the .procmailrc file, but make sure to watch the log file closely until you trust the setup. Be sure to remove the log file now and then if it starts to get too big

