Procmail recipe

Dallman Ross dman at
Sat Jan 24 16:35:49 CET 2009

On Sat, Jan 24, 2009 at 10:03:19AM -0500, Patrick Shanahan wrote:

> * Dallman Ross <dman at> [01-24-09 09:33]:
> > On Sat, Jan 24, 2009 at 09:17:42AM -0500, Patrick Shanahan wrote:
> > > 
> > > # -------------------------------------------------------
> > > :0:
> > > * ^X-BeenThere:.*lolica at
> > > $MAILDIR/
> > > # -------------------------------------------------------
> > 
> > Hi, Patrick,
> > 
> > Well, this approach is a little unusual, for the following
> > reason: MAILDIR, in addition to being a "magic" invocation
> > in procmail to chdir, also represents by the current working
> > directory.  So there is no difference between the folder
> > 
> >
> >   $MAILDIR/
> >  
> > and the folder
> >  
> >
> >   
> Well, please pardon me for being a bit dense here but reading your
> explanation and that offered in the Quick Start,
> leaves me somewhat confused (remember the advancing age).
> Mrs. McGough offers:
> MAILDIR variable  and  maildir format  (which are two completely
> different beasts!)
>     Unfortunately, the word “maildir” is used in (at least) two
>     different ways in the Procmail world. MAILDIR (in all caps) is a
>     Procmail variable that changes Procmail's current working
>     directory and is used to point to the directory where your
>     personal (non-system-spool) mailboxes are stored. For more
>     information about Procmail's MAILDIR variable, see the blinking
>     IMPORTANT note in Step 4 below. Maildir (not in all caps) is the
>     name of a mailbox format. For more information about the maildir
>     mailbox format, see Using maildir format, the maildir man page,
>     and the section below about delivering to a mailbox that is in
>     maildir format. 
> and "Step 4 below"
>     Make sure you replace MAILDIR=$HOME/Msgs with the directory where
>     your personal (non-system-spool) mailboxes are stored and that
>     this directory exists and is writable by your LOGNAME. The MAILDIR
>     variable specifies Procmail's working directory and all relative
>     paths are relative to this directory. 
> Are you saying that $MAILDIR should not be used or that the value of
> $MAILDIR tells procmail to use that value as it's working directory
> and that makes the delivery directory relivant to the cwd making
> $MAILDIR superfluous?
> Or does $MAILDIR (in this case) make it easier for me to read my own
> recipies :^)?

Nancy's explanation seems OK to me.  I think you're making it
too complicated. :-)  (By the way, I see a couple of typos in my
text to the list, for which I apologize.)  Anyway, basically, 
there are times when using $MAILDIR as a variable in a statement
pre-setting a path is useful to do.  E.g.:


   MAILDIR = $HOME/Mail/Lists    # I've just chdir'd there in procmail,
                                 # presuming, of course, the dir exists

   PLIST = $MAILDIR/procmail
   CLIST = $MAILDIR/csharp

   # do some other stuff in the current working dir in procmail

   MAILDIR = $HOME/Mail/Projects   # now we've chdir'd somewhere else

   # do some other stuff in the current working dir in procmail

   * ^X-BeenThere:.*procmail

   * ^X-BeenThere:.*C-Sharp


That would work fine.  It's not my idea of optimal organization,
since it makes no sense to me to have left the Lists dir and gone
somewhere else but then to have taken a time-out to bother processing
lists; but it would certainly work.  The list messages will be delivered
to folders under $HOME/Mail/Lists/, because that was the value of
MAILDIR at the time I defined PLIST and CLIST.

But now we return to your original suggestion.  There was no preset
variable.  You have procmail acting in real time on the value of
MAILDIR to deliver a message to a folder thereunder.  As we've
stated, MAILDIR is always the current working directory, however.
So it is a useless gesture.  It's sort of like always dialing a
full 10-digit number for all U.S. domestic phone calls, even 
when the numbers are in your local area code.  You can do it, but
it gains you nothing, and presenting the syntax as somehow exemplary
to be used in a How-To tutorial seems, as I said, odd. :-)

Nancy's point in her FAQ was simply that there is a completely
separate animal, the Maildir+ message-storing format, and that
it is not to be confused with the meaning of MAILDIR, the "magic"
variable that also performs a chdir operation, in procmail.

Hope that helps,

More information about the procmail mailing list