Subject: Re: using procmail as a POSTprocessor

From: "Joshua A. Laff" <[email-masked]>
Date: Sun, 13 Mar 1994 10:23:05 -0600 (CST)

In our previous episode, Simon McClenahan said:
:) folders, but that's my preference. What I want to be able to do is 
:) postprocess all my mail folders and extract messages according to 
:) whatever recipe I use, e.g. find all the mail that has anything to do 
:) with software package XYZ in it, or find mail that has uuencoded stuff in it.

Well, the first thing you obviously want to do is create your .procmailrc
with whatever recipes you need.

Then, for each non-mh folder (i.e. files containing multiple messages), run
the following:

formail -s procmail < <file-name>

This will cause <file-name> to be split up into separate messages, and each
one will, one at a time, be piped into procmail. You can then remove this
file. (This does mean none of your recipes should write to this specific
file-name). Now, if you only have a few messages in <file-name>, you can
speed things up by using "formail -n -s procmail", but I don't recommend the
-n flag unless you only have a few messages.

Then, you need to process each of the mh folders. I'd recommend the following,
assuming you're using csh or tcsh as your shell:

% cd <mh-folder-name>
% foreach file (`ls`)
? procmail < $file
? end
%

This will again, one at a time, pipe your mh style mail into procmail.
You can then remove these files. Again, you should not use the mh-folder-name
as a folder that procmail delivers to.

This all assumes procmail and formail are in your $path. If not, set your
path correctly, or call them with their full pathnames.

      Joshua A. Laff    (217)      //  Disclaimer: If I was important enough
    CRL Head Operator     333-    //  that the UofI would let me speak for it,
  University of Illinois   7408  //  the *last* thing I'd be doing would be
email to: [email-masked]      //  sitting in front of a computer all day.
===============================================================================
"I plugged my phone in where my blender used to be. I called someone. They
went 'Ahhhhhhh.......'" - Stephen Wright

---

From: Roman Czyborra <[email-masked]>
Date: Sun, 13 Mar 1994 20:18:36 +0100

Simon McClenahan <[email-masked]> asked:

> Can procmail MOVE (as in copy then delete) mail messages around?

No.  Procmail will happily lock a box for you while another Unix tool
extracts messages from it and rewrites or removes it, but it won't do
it itself.

> How do I specify something other than /usr/spool/mail/$LOGNAME

DEFAULT=resortedMail

> and how do I make it search say, everything in ~/Mail ?  Including
> all those MH directories?

cat Mail/* Mail/*/* | formail -s procmail resort.rc

> And what about sorting? Can procmail sort a mailbox by some given 
> field, like date of arrival?

I'm planning to write a GAWK script to do that this week.  Stay tuned
or overtake me.