OSU Navigation Bar

The Ohio State University

Department of Statistics

Cockins Hall
rollover image OSU Statistics
            Home

design element

OSU Statistics

Home

News

Research & Consulting Groups

People

For Visitors

For Prospective Students

For Current Students, Staff & Faculty

Contact Us



rollover image

For Current Students & Faculty

rollover image

Courses

rollover image

Links

rollover image

Computer Support

rollover image

Internal Documents

rollover image

webmail

Using procmail

Procmail is a useful tool that can redirect a message in any of several ways based on the contents of the headers or body. Most commonly it is used to direct messages from mailing lists into separate mailboxes, so that they can be read at a later time.

WARNING: using procmail incorrectly can irretrievably lose e-mail. Be certain of what you are doing when you use procmail.

Setup:

Procmail can be set up with the following steps, done from the prompt on a unix machine:

  1. Copy the default .procmailrc (procmail's resource file) to your home directory:

        cp /usr/local/dot-files/procmailrc.example ~/.procmailrc
        
  2. Do not create a .forward to use procmail. It will cause your e-mail to bounce.

  3. Edit the .procmailrc to set up rules as to what you want to be done in specific cases. Below is a simple example, but for complete information read the man pages procmailex, procmail, procmailrc, procmailsc.

A Simple Rule:

In the default .procmailrc there is a fictional mailing list as an example. You can change the information and uncomment it by removing the #s. In procmail's language the # is a comment.

But here is a real world example. Say you want all mail from joe_user@stat.osu.edu to be put in a mailbox joe_user in youre ~/mail directory. Add the following lines to your .procmailrc after the PATH and MAILDIR lines, with no leading spaces:

 
    :0:
    * ^From joe_user@stat.osu.edu
    joe_user
    

now all mail from joe_user@stat.osu.edu should go into the joe_user mailbox.

Now test this by sending yourself a quick message. It should appear in your inbox withing a few seconds. If it does NOT, there is a problem, in this case remove (rm) the .forward file (if you used one) and rename your .procmailrc to something else, maybe pmrc, immediately! If you get the mail, then eventually you will probably get mail which matches one of your rules, which will hopefully be dealt with accordingly.

It is necessary to look at the header of messages to determine what information to put in the .procmailrc file. With Outlook Express and Eudora this can be difficult. With pine most of the interesting headers are visible and the H command can be used to see full headers.

Using Vacation with Procmail:

See the vacation documentation on how to use vacation with procmail.

Notes:

The same can be accomplished in Outlook Express, or Eudora. Outlook calls these 'Message Rules' and Eudora call them 'Filters'.

Although procmail is failry reliable, sometimes it seems like it will miss a rule, and the message will end up in the inbox.

Since this works in your ~/mail directory and system inbox, it should be comapatible with POP/IMAP mail readers such as Outlook Express and Eudora.



If you have trouble accessing this page, or need an alternate format contact webmaster@stat.osu.edu.