procmail
[Top] [All Lists]

Re: splitting up mbox with formail?

1998-08-26 23:31:58
My only complaint is in swatting flies with bazookas.  I don't
think, in the scenario outlined by the initial message writer,
that it *does* have to be very tedious to save the messages
in a UNIX mail program.

I suppose that it's all relative.  To me, a large mailbox would consists
of about 10,000 messages per month (that's about what I get).  That would
mean that my mailbox would contain 60,000 messages in 6 months.  I sure
as heck wouldn't want to skim through it all or even try to load it up
in an MUA.

I would think I'd have the job done inside two minutes without rushing.
So why (other than for the intellectual exercise and to collect yet
another model of application) would you want to do this one-time task in
procmail?  Admittedly, if he will later continue to store by month then
the extended recipe has more value.

For some it's not a one-time job.  My intent was to provide a script that
catered to the lowest common denominator.

On another note, I was hoping someone would have responded to my
question of yesterday to this list re. how I might use mail from work to
trigger the wholesale shipping of my home mail spool to my work address.
I had provided a draft recipe that I was afraid to test because my
procmail coding is so rusty. . . .  Did that somehow not get posted to
the list?  I forgot to pay attention to whether it appeared here.

I don't remember the specifics, but I think you were pretty close.  You'll 
probably want to use the -f flag with sendmail when you forward your 
messages if you want to keep the From_ line moderately intact -- otherwise
you might lose it.  Could be important if filtering on this header.

   cat mbox | formail -s procmail -m procmailrc

Your procmailrc file would look something like this:

   :0
   {
      :0
      * ^From \/[^ ]+[ ]+
      | $SENDMAIL -f$MATCH my(_at_)work(_dot_)account
   
      # catch the extras
      :0
      ! my(_at_)work(_dot_)account
   }

You may end up with an X-Authentication-Warning header, but it's harmless
and worth it when you consider what would happen to your From_ header
otherwise.

If you're going to do this with a lot of messages, I'd recommend sticking
the messages in the queue and letting sendmail deal with it later.  
Otherwise you're bound to kill your server.  Unfortunately, I can't
remember the flag for the life of me right now.

Chris