Mail Management With Procmail - Speaking Geek (
Page 2 of 8 )
Let's start with a very basic question - what is procmail, and how is it going
to make your life more fun?
Before I can answer that question, there are
three acronyms you need to learn. Here they are:
MTA: An MTA, or mail
transfer agent, is a program that routes mail from one host to another on the
Internet. An MTA accepts email, looks at the destination address, and either
passes the message on to another MTA or hands it off to an MDA for delivery to a
local mailbox. Examples of common MTAs are sendmail and qmail.
MDA: An
MDA, or mail delivery agent, is the program that accepts email from an MTA and
actually delivers it to the recipient's mailbox. When an MDA works locally -
that is, delivers mail to user mailboxes local to that host only - it is
sometimes referred to as an LDA, or local delivery agent. Examples of common
MDAs are procmail and mail.local.
MUA: An MUA, or mail user agent, is the
program users interact with to view email messages, reply to or forward them,
compose new messages and otherwise manipulate the contents of a mailbox.
Examples of common MUAs are pine and mutt.
In a typical *NIX environment,
the MTA takes care of accepting email messages and figuring out how to deliver
them to their destination. Once the email message actually reaches the
destination host, control passes to the LDA, which takes care of delivering the
incoming message to the specified user's mailbox (or "mail spool") on that
system. The user may then use any MUA to view and manipulate the mailbox and its
contents.
Where does procmail fit into this picture? Developed by Stephen
R. van den Berg in 1998, procmail is an LDA, commonly used to deliver messages
to local mailboxes. Don't think of it as just a delivery boy, though -
procmail's built-in constructs allow you to convert it into a primitive mail
robot, automatically scanning and sorting received messages according to
pre-defined rules.
These procmail rulesets (or "recipes") are very
powerful - they allow you to do all kinds of magical things to your email,
including automatically forwarding it elsewhere, starting special programs on
your system for different types of email, filtering it into different mailboxes
or - this is the part I like the most - automatically trashing spam without you
ever having to see it.
The end result? Automatic, transparent mail
management that allows you to zero in on important email, leaving the chaff for
later.
Intrigued? Flip the page and let's get going!