top curve

Procmail And The Vacation Program

This document contains

General Information

Procmail is what's known as a mail processing utility. This means that it can be used to filter your mail (our primary purpose), sort incoming mail, or other such processes. We'll focus on the filtering aspect of it. If you would like more information about procmail usage, see their homepage.
Using procmail to filter is quite simple. Listed below are instructions on how to set it up for your own account. Procmail works by comparing the values and tolerances that you have set up in your .procmailrc file to parts of your incoming emails. The primary method of comparison that we suggest is using the X-Spam-Level tags that SpamAssassin inserts into the headers of your emails. If you would further like to add to your .procmailrc file, procmail has mail sorting capabilities. This will allow you to route emails from a certain sender or even mail with subjects that contain certain text.

How to Set-Up Procmail

To delete messages marked as spam or to reroute them to a separate mail folder, you will need to configure your procmail resource file (.procmailrc). As mentioned before (How can I tell whether or not SpamAssassin thinks a message is spam?), there are varying levels of SpamAssassin surety that a particular message is spam. You can configure procmail to perform different actions on your mail messages based on the spam scores SpamAssassin assigns. For example, many of our users choose to delete messages with a spam score above a certain threshold and move messages with a low-to-midlevel score to a separate folder that can be periodically examined for false positives. A commented example .procmailrc file is here.
You will also need to change your .forward file to be the following line of text:

"| /usr/cs/bin/procmail"

This will invoke your mail client to use your .procmailrc file. See below for examples of .procmailrc files.
Examples
Listed below are examples of .procmailrc files which can be copied directly into your home directory. They are all a simple text files which will set up your email to run procmail. There are varying degrees of filtering, so choose the file that you feel most comfortable with. Typically users like to start conservatively and monitor activity while they slowly increase their spam levels to their desired levels.
To use these files, right-click on the links and save them. You will need to rename them as .procmailrc to enable filtering and to change the appropriate variables to match the information corresponding with your email account.
  • This is our standard file that we recommend our users start off with. This procmail file has three various of spam filtering; High, Medium, and Low. All emails that are filtered out of your inbox in this system are then filed into three corresponding mail folders called maybeSpam-High, maybeSpam-Med, and maybeSpam-Low. These folders must then be emptied by by you, the user. It is smart to scan thru the filtered emails to ensure that no false-positives are lost.
    Tiered procmail file (right-click on link and save)
  • This file for tweakers who want to customize their own SpamAssassin ruleset and databases. This works like the previous example and it additionally passes all emails below a certain spam threshold to spamd.cs.virginia.edu for further processing. This invocation of SpamAssassin will look in /home/UID/.spamassassin for baysean database and the "user_prefs" config file.
    User customizable filtering with spamc (right-click on link and save)

Vacation Program

The vacation program makes it so that when you are on vacation and someone emails you, they will receive an automatic reply stating a message of your choosing. Once a person sends you an email and receives an auto-reply, their email address will be stored and if they email you again within the next 2 weeks they will not receive the auto-reply again.
Vacation uses procmail to work. Directions are listed below for those users who are already set up with procmail as well as those who need to set it up.
Please do NOT try to invoke the vacation program through the command line. This will erase your .procmailrc file and make it so that you have to set procmail and vacation up all over again each time you run it.

Existing Procmail Users

If you already have a .procmailrc file in place, enabling the vacation program is a breeze. If you got your .procmailrc file from any of the above locations, the recipe for the vacation program already exists, you just have to uncomment it to make it work. If the vacation recipe is not already in your procmail, simply place the following lines at the bottom of your .procmailrc (after the spam filtering).
# Uncomment the rule below to implement vacation with procmail.
# If more than one alias, precede each one with the -a option
# Example: | /usr/bin/vacation -a smith -a andrewsmith ahs3p
# :0 c
# | /usr/bin/vacation -a $ALIAS1 -a $ALIAS2 $LOGNAMEs
After you have your vacation recipe in place, you need to create a .vacation.msg file. This is the message that people will receive automatically if they email you while your vacation message is turned on. Here is an example message:
From: abc2d (via the vacation program) Subject: Out of the Office I am on vacation from 01/01/06 until 01/10/06. I will read your message regarding '$SUBJECT' when I return. Thanks
There is no special syntax, just write your message as you would like it to appear in a return email to the original sender.
When you come back from your vacation, simply comment back out the two lines in your .procmailrc and you can leave your .vacation.msg standing. This way it is easy to change for the next time you will be away.

First-Time Procmail Users

Vacation uses the procmail system, so to enable the vacation program it is necessary for you to implement, in at least a bare-bones fashion, the procmail setup. For instructions on the full blown set up, see above. If you are interested in only using procmail for the vacation program, please see the following instructions.
The first thing you need to do is create a .procmailrc file. Since you are only using procmail for the vacation program, the file is very simple; here is an example which you can save and use for yourself. Simply change the variables to correspond to your information.
After you have saved that file and named it .procmailrc in your home directory, you need to change your .forward file to the following line of text:
"| /usr/cs/bin/procmail"
This will direct your email to go through procmail before entering your inbox. The last thing you need to do is create a .vacation.msg file which will contain the information you want emailed back to anyone who sends you mail while you are out of the office. Here is an example message:
From: abc2d (via the vacation program) Subject: Out of the Office I am on vacation from 01/01/06 until 01/10/06. I will read your message regarding '$SUBJECT' when I return. Thanks
There is no special syntax, just write your message as you would like it to appear in a return email to the original sender.
When you come back from your vacation, simply comment back out the two lines in your .procmailrc and you can leave your .vacation.msg standing. This way it is easy to change for the next time you will be away.
Please email root@cs.virginia.edu if you have any questions concerning the setup of either procmail or vacation.