User Tools

Site Tools


email:procmailrc

Table of Contents

.procmailrc

Procmail is a powerful tool to handle incoming email based on regular expressions applied to various parts of the mail. It's most use is to sort mail into subfolders, so this is where we'll start:

Subfolder

Take the following sample config:

MAILDIR=$HOME/Maildir

:0
* ^From.*harry
subfolder/

it will save all passed mails matching harry in the From: field of the mail header into the maildir $HOME/Maildir/.subfolder, all else into the default maildir $HOME/Maildir. See also this article about maildirs.

spamc

This is a sample config used to have incoming mails checked by spamc:

# Sample .procmailrc file
#----------------------------------------------------------------------#
# Your procmail logfile will grow rapidly so remember to comment out
# the first line "LOGFILE=$HOME/.procmailrc.log" once you've verified
# that procmail is performing as expected

LOGFILE=$HOME/.procmailrc.log
VERBOSE=no
COMSAT=no
MAILDIR=$HOME/Mail
PATH=/usr/local/bin:/usr/bin

#---------------------------------------------------------------------#
# (part 1)
# The following entries will invoke spamassassin to catch SPAM
# and put into "caughtspam" folder in your Mail directory. You can go 
# through the "caughtspam" folder using pine or mutt and remove the 
# messages there.  The 2nd line "* < 25600" is to scan messages less 
# than 256KB only.  You can comment out the 2nd line if you want to 
# scan all messages.

:0fw:spamassassin.lock
* < 256000
| /usr/local/bin/spamc

:0:
* ^X-Spam-Status: Yes
caughtspam


#---------------------------------------------------------------------#
# (part 2) 
# Add your own filtering commands here, if you want.


#---------------------------------------------------------------------#
# (part 3) How to set up vacation message
#   1. No need to set up .forward file if you use this method.
#   2. Prepare .vacation.msg in your home directory.
#   3. Run "vacation -I" command.
#   4. Uncomment the 2 lines below (Did you replace your_loginname with yours?) 
#   5. Remember to comment out the 2 lines when you come back from vacation.

#:0 c
#| /usr/bin/vacation your_loginname
email/procmailrc.txt · Last modified: 2009/01/12 02:28 by 127.0.0.1