Everything2
Near Matches
Ignore Exact
Full Text
Everything2

procmail

created by QuMa

(thing) by QuMa (11.6 mon) (print)   ?   (I like it!) Fri Jan 21 2000 at 19:31:48

A piece of software that sorts mail, and more. Much more.

It can run all mail you receive through programs, thus creating autoresponders, or it can merely puzzle you with it's slightly obscure language of recipes.

Its mode of operating is your MTA calls it when doing local mail delivery, and pipes the mail in question through it. Procmail then reads it's run-commands file named ~/.procmailrc and tries to match the message against every rule specified therein. If the message matches, the corresponding action is performed. There is a lot you can do in "the corresponding action" however, so this can get complex quickly.

If your local MTA isn't set up to run locally delivered mail through procmail but procmail is installed (or you installed it yourself), often creating ~/.forward and putting "|/path/to/procmail#your-userid-here" in it will make local mail be delivered through procmail for you.

The reason for the #your-userid-here; thing is mostly historical, this is actually a comment and not executed, but is a workaround for a bug where the MTA gets confused; it's usually not necessary. Then again, it never hurts, the file's going to use up an entire block of diskspace on most filesystems anyway.


(thing) by everyone (3.3 mon) (print)   ?   (I like it!) Thu Feb 15 2001 at 14:22:27

As QuMa quite rightly said procmail is indeed cool as well as being very powerful:
"Procmail can be used to create mail-servers, mailing lists, sort your incoming mail into separate folders/files (real convenient when subscribing to one or more mailing lists or for prioritising your mail), preprocess your mail, start any programs upon mail arrival (e.g. to generate different chimes on your workstation for different types of mail) or selectively forward certain incoming mail automatically to someone"(*).
Though difficult to get one's head around its rules system is quite straightforward once you understand it. Here is a pretend .procmailrc file:
SHELL=/bin/bash
MAILDIR=$HOME/mail
DEFAULT=$HOME/Mailbox
LOGFILE=$MAILDIR/logfile
SENDMAIL=/usr/sbin/sendmail
VERBOSE=no
MY_MAIL_ADDR=foo@foo.com

# junk rules
:0 H:
* ^(From|X-From-Line|Return-Path):.*hotmail\.com
* !^X-Originating-IP:
junk

# Temporarily catch the rest of the mail, just in case...
:0 c
mail-inbox-copy

# Switching final delivery to qmail...

:0
* ^TO*
! mymailbox@foo.foo.com

The top is the header, then the rules start. A rule begins with :0 and ends at the next one... If there are no characters following the 0 then it is a normal, filtering rule (i.e. it filters mail matching the regular expression to where you tell it); if it is anything else (e.g. a c -- copy -- or f -- filter but then pass on to next rule) then it does what you tell it (again). The next bits (starting with the *s are the regular expressions -- they can get quite complicated -- and then the last bit is what to do with it (e.g. just put it in a folder, or forward (!) on to another e-mail a/c).

More succinct info can be found at:

  • the Procmail homepage -- http://www.procmail.org/
  • ii.com's "Processing Messages with Procmail" -- http://www.ii.com/internet/robots/procmail/
  • The Procmail mini-FAQ -- http://www.ling.helsinki.fi/users/reriksso/procmail/mini-faq.html
  • Jari Aalto's procmail pages -- http://www.procmail.org/jari/

(*) procmail.org, the procmail homepage


printable version
chaos

procmail recipe to drop (forged) Hotmail spam procmail recipe to auto-acknowledge receipt procmail recipe to drop mail that's not for you How to write sendmail.cf
XP Whoring for Dummies SpamAssassin exim There are more stars in the universe than grains of sand on earth
e-mail system LDAP MTA .forward
b1ff Qmail SMTP Postfix
Dope Wars mail headers Small helpful scripts for noders DocBook
PowerMac G4 Avoid highly subjective writeups symbolic link hick
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Drink up!
Carole King
Five sonnets of vanity
A boy, a girl, a big fat dead old lady
trichotillomania
Dragon
Christianity
Innervisions
September 11, 2001
Under the Hood of the E2 Zen Theme
Wedge-tailed eagle
A Table Alphabeticall
Going to the movies in Thailand
Nystagmus
New Writeups
Nadine_2
The Sound Of Madness(review)
Twin Eclipse
Conversations with God: An Uncommon Dialogue(idea)
SwimmingMonkey
Conversations with Fo Fo- the Loneliest dog in Purgatory(fiction)
locke baron
lynx(thing)
Simulacron3
Reality, Dimensions and the Natural Ontology(essay)
SubSane
Making Love to a 9-Foot Woman(person)
Ouzo
Thoughts(idea)
antigravpussy
I fall silent, listening. The breadcrumbs are talking about us(person)
calgon
Buffalo Bill by the pool(poetry)
gate
Anarchy is Order(idea)
ushdfgakjasgh
Scribeling(thing)
XWiz
Trism(review)
artman2003
Briefcase Full of Souls - Part I(fiction)
Dreamvirus
Alan Ladd(person)
waverider37
Harold Holt(person)
E2 is a by-product of the existence of The Everything Development Company