procmail
[Top] [All Lists]

Re: unprocessed message leaking through filter perl script

1999-01-30 02:12:34
I subscribe to about ten "daily tip" mailing lists.  I send the tip
message through a perl script to extract the tip from the fluff
and append the tip to a file.  This works just fine.  Randomly,
one or two complete tip messages each day are also delivered
directly to my mailbox.  This I don't understand.  I guess it must
be some locking problem, but adding :'s didn't have any effect.

Here is a typical recipe in my .procmailrc

:0:
* Sender: owner-netscapetips(_at_)tipworld(_dot_)com
| tipworldtip >>/home/buck/mail/win95/netscape.tips

[stuff deleted]

Can anyone explain why this is happening and what I might do to
stop it?

You definitely want to keep lockfiles in there.  Your recipe should work
for most cases, but you could tighten it up and put on some finishing
touches:

   :0b:
   * ^Sender:[    ]+owner-netscapetips(_at_)tipworld\(_dot_)com
   | tipworldtip >>/home/buck/mail/win95/netscape.tips

The 'b' tells procmail to only send the body of your message on to
your script.

The caret in from Sender anchors the regex to the start of the line, so
you don't mismatch headers (i.e. X-Sender).  The characters in brackets
include a space and a tab, so it'll essentially match all whitespace up
to the first word.  Also note the escaped '\.' in '.com'.

OK.  So why would it be failing?  You probably should turn on VERBOSE
logging and check out what procmail tells you.  Add this to the top of
your .procmailrc file:

   LOGFILE=/safe/directory/to/write/to/logfile
   VERBOSE=on

Obviously replace LOGFILE with a valid filename that you can write to,
access, and know will be stable.  My guess is that for some reason
or other your script is unavailable to the server, so procmail
continues processing the message and dumps it into your mailbox
since it fails all other recipes (like a big safety net).

You can check by adding this recipe immediately following your
tips recipe (assuming that formail isn't running out of your
home directory):

   :0 fhw:
   * ^Sender:[    ]+owner-netscapetips(_at_)tipworld\(_dot_)com
   | formail -A"X-Comment: This should have matched earlier"

If that X-Comment header shows up on the message that made it
through then it's probably something to do with the script.  If
not, then it's something about the Sender: line.

Chris

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