procmail
[Top] [All Lists]

Re: processing inbox maildirs with formail

2007-08-27 10:06:22
On 8/27/07, M. Fioretti <mfioretti(_at_)nexaima(_dot_)net> wrote:

##################################################################
#! /bin/bash

cd /the/maildir/base/directory/
for file in cur/*
  do
  /usr/bin/formail -s /usr/bin/procmail -m test/rcfile.rc < $file

You don't need formail here.  There's only one message in $file, so
formail has nothing to "split" (the meaning of -s).  Simply do

/usr/bin/procmail -m test/rcfile.rc < $file

I would also suggest that you avoid looping over cur/* and instead do only

for file in new/*
do
/usr/bin/procmail -m test/rcfile.rc < $file
mv $file cur
done

Otherwise you need some alternate way to avoid re-processing the same
files every time your script runs.  Unless that's the idea, in which
case go right ahead ...

with respect to your other explanations, I had already discovered (or
more exactly, remembered by experiment) doing this that procmail
leaves the original mail where it was and leaves an *extra* copy of
everything which didn't fit in the recipes into DEFAULT. So right now
I am tempted to put DEFAULT = /dev/null in the rc file

Another approach is to end the file with

SWITCHRC

For a procmail invoked from the MTA (e.g. postfix) this will fall back
to default delivery, but for "procmail -m" this causes procmail to
stop (with a non-zero exit status).
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail