Martin Thompson asked,
| :0:
| *^From:.*postmaster
| IN.mailprob
| :0:
| *^To:.*root
| IN.root
Consider using the ^TO or (if your procmail is recent enough) ^TO_ token
there instead of "^To:.*". Anyhow,
| :0 B:
| *beginning.*of.*open.*letter
| *end.*of.*open.*letter
| |/apps/local/bin/noletter >> IN.letter
| :0 E:
| *^Subject:.*open.*letter
| IN.letter
| :0 B:
| *beginning.*of.*open.*letter
| *end.*of.*open.*letter
| /dev/null
| noletter.c is a simple 'C' program which filters text. The problem I am
| having if I omit the last recipe is that the mail with filtered body goes
| to IN.letter alright but a copy of the original message if it matches the
| third recipe was getting passed to my default mail file necessitating the
| fifth recipe. What am I doing wrong? Is it obvious?
You don't have a `w' or `W' flag on the recipe that calls noletter, so
procmail should be ignoring noletter's exit code. Here's a question: does
noletter stop reading input when it sees the line "end of open letter"? Then
procmail might be noticing a write error. What does your logfile say? Have
you tried turning VERBOSE on to get more diagnostics logged?
If that's the case, adding an `i' to the recipe that invokes noletter should
ease the problem. If not, we can make your existing code a little more
efficient (and a little tighter, making sure that "beginning|end", "of",
"open", and "letter" are all separate words):
:0Bi:
* ()\<beginning\>(.*\>)?of\>(.*\>)?open\>(.*\>)?letter\>
* ()\<end\>(.*\>)?of\>(.*\>)?open\>(.*\>)?letter\>
| /apps/local/bin/noletter >> IN.letter
If we use the `A' flag, we don't need to search for the expressions all over
again; also, a dump to /dev/null doesn't need a local lockfile, and you can
make procmail lose the body the fast way:
:0Ah
/dev/null
:0:
* ^Subject:(.*\<)?open\>(.*\<)?letter
IN.letter