University of Oregon



Webmail users have access to text-based mail filtering software Procmail. Procmail is a little tricky to use, and setting it up requires familiarity with SSH as well as a UNIX text editor. Before embarking on this path, also consider that Procmail is not supported; it is considered a do-it-yourself tool.

Initial set up

Procmail executes everything in your .procmailrc file located at the root of your home directory on Shell. If you've never used Shell before, you may need to enable Shell access. Connect to Shell using an SSH client. If you're not sure how, see How to Login to Shell.

You most likely need to create your ~/.procmailrc file from scratch. Create it with the following contents:


The above line specifies where information gets logged. This way if anything isn't working as expected, you can view your ~/procmail.log file to hopefully figure out what went wrong.

Hello World

Let's say that we want to create a recipe (which is Procmail's term for a filter) that will automatically move emails with "FilterThis" in the subject into your "Hello World" mail folder.

First, edit your ~/.procmailrc to add the following line:


This tells Procmail to include the contents of the file ~/rc.HelloWorld. We will create our recipe there. (You could instead create the recipe in your ~/.procmailrc file but that can get messy if you eventually create lots of recipes.) As explained in this quick reference guide , each recipe has three distinct sections:

  1. Colon/Options line. There are many options/flags that can be included.

  2. Condition line(s). Conditions are optional. If you don't include any, the recipe will run on all incoming mail. If you have multiple conditions line, then all of them must be met.

  3. Action line.

Create the file ~/rc.HelloWorld with the following contents:

* ^Subject:.*FilterThis
$HOME/Maildir/.Hello World/

The first line just signifies the start of the recipe. The first two characters are always required, and the trailing colon tells Procmail to use a lockfile when processing this recipe (recommended in most cases).

The second line tells Procmail to apply this recipe on any incoming mail that has "FilterThis" anywhere in the subject line, and the third line tells Procmail to move the message into your "Hello World" folder.

Where to go from here

Procmail is a very powerful tool, capable of far more than simply filing mail with a particular subject. Unlocking its potential will require wading through more documentation. This Procmail guide hosted by the University of Maryland Baltimore County provides a more thorough introduction. Beyond that, searching the web or or browsing Procmail's man pages from Unix should be helpful.