[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vps-mail] proctut0: Procmail Basics
- Subject: [vps-mail] proctut0: Procmail Basics
- From: Scott Wiersdorf <scott@xxxxxxxxxxxx>
- Date: Fri, 22 Aug 2003 11:46:43 -0600
An updated version of this document may be found at:
<http://www.perlcode.org/tutorials/procmail/proctut/>
Scott
--
Scott Wiersdorf
scott@xxxxxxxxxxxx
NAME
Procmail Basics
SYNOPSIS
This tutorial will discuss what procmail is and why it might be useful
to you in controlling what comes into your mailbox.
DESCRIPTION
Procmail, at its heart, is a mail processor; it PROCesses MAIL. Part of
its process is to scan the mail and look for anything you've told it to
look for, and then to deliver the mail where you tell it to be
delivered. Simple.
Now the trick is to figure out how to tell it what to look for and what
to do with it once it's found what it's looking for. A little
terminology is appropriate here.
Introduction to recipes
Procmail uses recipes to determine what to look for and what to do once
it's found what it's looking for. A simple procmail recipe might look
like this:
:0:
* ^From:.*joe@schmoe\.org
joe
This recipe looks for email messages from 'joe@xxxxxxxxxx' and delivers
them to a file called joe. Once an email is delivered (i.e., written to
a file), procmail stops processing[1] immediately[2] and all subsequent
recipes are ignored.
If an email message does not match a recipe (e.g., in this case, if the
message were not from 'joe@xxxxxxxxxx'), the email moves on to the next
recipe until a matching recipe is found. If no matching recipes are
found, the next recipe file is examined.
Where are the recipes?
Procmail looks for recipes in the following locations[3] (and in this
order):
/usr/local/etc/procmailrc (or /etc/procmailrc)
$HOME/.procmailrc
Once procmail finds one of the above files, it reads it for recipes. If
the file does not exist, or none of the recipes match the email,
procmail will read the next file until a matching recipe is found. If no
matching recipes are found, the mail message is said to "drop off the
end" and is delivered to the default mailbox for the recipient (e.g.,
/var/mail/scott).
SUMMARY
Procmail is a powerful tool for scanning and redirecting incoming mail.
Procmail uses recipes to determine what to look for and what to do with
mail. Recipes are found in the /usr/local/etc/procmailrc and
$HOME/.procmailrc files[3]; procmail searches each of these files in
turn until a matching recipe is found. Once a matching recipe is found,
procmail delivers the mail and processing immediately ceases[2] and
subsequent recipes are skipped[1].
NOTES
[1] Unless you've made a *copy* of your email with the 'c' flag.
Discussed in subsequent articles.
[2] We do not discuss *non-delivering* recipes here. We'll talk about
those in later articles.
[3] There is another location that is searched after the global
/usr/local/etc/procmailrc and before the user's $HOME/.procmailrc file.
This location is a directory and is located at
/usr/local/etc/procmailrcs. Discussed in subsequent articles and in
procmail(1).
PREVIOUS
This is the first procmail tutorial in a series.
NEXT
*Anatomy of a Procmail Recipe, Part I*
SEE ALSO
procmail(1), procmailrc(5), procmailex(5)
AUTHOR
Scott Wiersdorf <scott@xxxxxxxxxxxx>
COPYRIGHT
Copyright (c) 2003 Scott Wiersdorf. All rights reserved.
REVISION
$Id: proctut0.pod,v 1.2 2003/08/21 17:04:57 deep Exp $
Main Index |
Thread Index