How do I add the newsgroup line?
:0fh
| formail -I"Newsgroup: whatever"
How do I perform your action on the messages inside the digest?
Split them with formail, and run the recipe file with "procmail -m" on
each message.
this is what I'm using now
:0
*^Subject: next-software
| formail +1 -des procmail $DIGESTS/Software
To perform a recipe on each message in a digest, you must run a procmail
filter on each message. What you suggested looks fine; of course, I
can't test it myself.
formail -des procmail -m some-recipe.rc <digest-file
The recipe file "some-recipe.rc" is a file which you must prepare with
the desired recipe. If your final recipe in that file is:
:0
|
Then the recipe file will act like a "normal" Unix filter, and the mail
will appear on the STDOUT, with whatever changes you have applied.
In other words, you can run the "filter.rc" like this:
procmail -m filter.rc <mailinput >mailoutput
Of course, you can also program the recipe to file the messages, either
to a folder or directory, or, you can pipe it to a program.
To write a procmail recipe "filter" as a program, do something like
this (your system and shell must support "#!" interpretation):
Create the filter program; I'm calling it "filter":
#!/usr/local/bin/procmail -m
# whatever recipes you like, such as these...
:0Wh: # check the message-ids
* ^Message-Id:
| formail -D 8192 .msgids
:0E # else, check for md5 checksums
{ :0b
SUM=|md5sum
LOCKFILE=.checksums.lock
:0Wih
| fgrep -s "$SUM" .checksums
JUNK=`(tail -8000 .checksums; echo "$SUM")>.checksums.new;
mv .checksums.new .checksums`
LOCKFILE
:0fh
|formail -I"X-Checksum: $SUM"
}
:0fh # mark a news group??
| formail -I"Newsgroup: foobar"
:0 # final recipe to show the mail on STDOUT
|
Mark the file as executable:
chmod +x filter
Then, use the "filter" program like this:
formail +1 -des filter <digest-file >filtered-digest-file
Only the messages which are passed by the "filter" script will be
written to "filtered-digest-file".
If you write "filter" to submit the messages to a pipe, then you don't
need to redirect STDOUT on the "formail" command line.
___________________________________________________________
Alan Stebbens <aks(_at_)sgi(_dot_)com> http://reality.sgi.com/aks