Skip Navigation

Setting Up Procmail

Summary: If you want to filter your messages on the server, you can use Procmail and create "recipes" to move your mail to folders you choose or to the trash.

What is Procmail?

Procmail is an application on the server used to filter and sort incoming mail based on certain criteria such as the email's sender, subject, header or other similar field.

You specify the conditions and course of action by giving Procmail sets of instructions known as "recipes". Though email programs such as Outlook, Eudora, and PINE have their own filtering options, Procmail allows the sorting and filtering on the server so that email programs download them pre-sorted.

This is especially useful for people who check their email on multiple machines or email programs. Also, because Procmail recipes can look at email headers, this allows the filtering of spam marked by UCI's SpamAssassin, especially useful because Outlook Express and UCI's Webmail can't filter such email.

Return to Top

Who can use Procmail?

Faculty & Staff
By default, you can't use Procmail because setting up "recipes" requires shell access. If you want to use Procmail on your E4E account, email NACS for more information.

If you use Eudora, Outlook, Netscape Mail or other advanced email clients, you can also use the message filtering features that come with the software instead of Procmail. We have instructions to help guide you.

Students
You have shell access on your EA account. Follow the instructions below to set Procmail up and create recipes.

Return to Top

Procmail Instructions

  1. Use a telnet or SSH client to connect to the host: ea.nacs.uci.edu.
  2. If you see the "Electronic Access Menu System", press the "Q" button to quit the menu system.
  3. Otherwise you should be at the UNIX "shell" (command-line) prompt on ea.nacs.uci.edu.
  4. To see where your directory is, type:
    pwd
    It should return your directory. e.g.) ea/unaffil/aaaatest
    The directory that appears will be important later.
  5. Create a Procmail file by typing:
    cd
    pico .procmailrc
  6. Enter the following by typing it or by using copy & paste (recommended):

    # BEGIN-------copy here-------copy here-------BEGIN

    # Set to yes when debugging
    VERBOSE=no
    # Remove ## when debugging; set to no if you want minimal logging
    ## LOGABSTRACT=all

    # Replace $HOME/Msgs with your message directory
    MAILDIR=$HOME/mail

    # add procmail recipes after here
    :0:
    * ^Subject:.test
    in-testing

    # END---------copy here-------copy here-------END

  7. Make sure you replace $HOME with the directory that was given in step 1.
    e.g.) if your UCINetID is "peter" enter in:
    MAILDIR=/ea/ex/p/pe/peter/mail

  8. Type Ctrl-X, Y, then Enter.

Return to Top

Testing Procmail

  1. Send yourself two test messages: one that contains "testing" in the Subject and one that does not contain the string test in the Subject.
  2. Use pine to access email. The email message with "testing" in the subject line should be in a mail folder "in-testing" and the message without "testing" in the subject line should be in the INBOX.   

Sample Procmail Recipes

  1. Simply add and edit the following sample recipes at the end of your .procmailrc file to suit your needs.

If you want to filter email from the mailing list w01-55522@classes.uci.edu into a folder called "English20":

:0
* ^From.*w01-55522*
English20
 

If you want to filter email with subjects that contain the word "test" (e.g. testing, testimony, etc.) into a folder called "test-results":

:0:
* ^Subject:.test
test-results
 

If you want to match ONLY the word "test" into a folder called "test-results":

:0:
* ^Subject:.*\<test\>
test-results
 

If you want to filter email from "nba.com" AND has the word "schedule" in the subject field:

:0:
* ^From.*nba.com*
* ^Subject:.*schedule
basketball-schedule
 

If you want to filter UNWANTED email from "advertising.com" (i.e. never come in contact with it):

:0
* ^From.*advertising.com*
/dev/null
 

Return to Top