procmail
[Top] [All Lists]

Re: Use procmail to split nntp messages

2001-11-01 08:34:44
PSE-L(_at_)mail(_dot_)professional(_dot_)org (Professional Software 
Engineering) writes:

At 20:12 2001-10-31 -0800, Harry Putnam wrote:
I've processed news or other one file per message format stuff with
procmail before by inserting a "From " line at the top and feeding to
procmail like a spool.  It works and is handy.

However I've wondered a time or two if there is something internal in
procmail that can be easily hacked to make it accept a regexp for
first line of message identification.

Hmm, perhaps you're confusing procmail and formail.  procmail operates
on individual messages, not mail spools.  If you have a mailbox with
multiple messages in it, you need to use formail to "burst" these into
individual messages to pass to procmail, one message at a time.

[...]

trn has an option (in fact, it automatically prompts when creating a
new file) to save in either mailbox or a standard news format.  Other

Yes, it is the combination of the two I actually use

My Mail/news reader "gnus" has an array of method to save messages.
No problem saving news as mail in several formats.  I'm talking here
on a scale that doens't really fit that kind of technique.

I think I'm playing over my head here a bit..to boot.  No doubt revealing the
true depths of my ignorance.  Snipping your usefull commentary
(thanks ) 
Looks like I'm probably going about this all wrong and formail doesn't
need to be involved.

I'll try to describe an actual working example

[...]

And even if there is a way for procmail to process the one file per
message format without me having to spoolify it.

I don't follow your "spoolify" bit here.  What exactly are you doing
to accomplish this now?

Here I meant feeding messages to the command below in a stream.

Without really understanding why this works or how it works, I've been
using a technique posted here long ago by Walter Dnes in May of 1999.
I don't still have all the message headers, or I'd cite the
message-id.

What follows from here might best described as my own uninformed
tinkering.

Walter described a setup he used to test procmail recipes or other
procmail related experiments without messing up real mail.   In basic
outline it consists of:
   
   a working directory
   a $maildir
   a script to be called that deletes the results of experiments
   a .procmailtestrc  With the appropriate VARIABLES, so mail is `delivered'
   to this test area.  To give an example, a  few of them might look like
   this:

  MAILDIR=$HOME/projects/proc/spool
  LOGABSTRACT=ALL
  ORGMAIL=$HOME/projects/proc/$LOGNAME
  DEFAULT=$ORGMAIL
  ##INCLUDERC=procvars
  VERBOSE=YES
  LOGFILE=$HOME/projects/proc/.log
  
  Recipes below..
  [...]
  (For simplicity, only one)
  0:
  messages.in

An example command looks like (wrapped for mail):
    cat test_mbox_file| formail -e -s procmail -m \ 
     ${HOME}/projects/proc/.proc_test_rc

`test_mbox_file' would be a spool file where I've saved mail in mbox
format.

I wanted to do the same thing with news I have archived on disk.
Like splitting it to smaller directories by date or subject.
Its archived in one message per file, numbered file just as it came of
the nntp server.

So trying to emulate an nntp feed by adding the dot on a line by itself
and a blank line to each message and directing it at procmail/formail.

In my experiments I found that trying to send news thru without adding a
"From " line at the top, doesn't work.
      (aside: Maybe my command line including formail is all wrong..)

Something like:
(From a Newsarchive directory saved on disk)

      cat 40 41 42 43|fix.news| formail -e -s procmail -m \ 
                   ${HOME}/projects/proc/.proc_test_rc

(Where `fix.news' adds only a dot by itself on a line and a blank line,
 approximating what an nntp feed looks like)

Fails... It puts everthing into one message.  The first one coming
thru.  However if `fix.news' also adds a "From " line of the form
       `From me(_at_)home Thu Nov  1 06:36:54 2001'
Then it all works.  This led me to think procmail/formail depended on
that "From " line.
My posts here were attempting to find out about a better way to do
this.

At some point maybe even to run a real nntp feed into procmail in real time.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>