procmail
[Top] [All Lists]

Recipe for the Bit Bucket

1997-01-04 16:13:51
    Please feel free to point me to a more appropriate source of
information.

    I use procmail v3.10 (what my ISP has) under SunOS 4.1.4.  Mostly 
I use it just for filtering incoming mailing list mails into separate
folders.  However, recently I have found myself wanting to discard
certain mails from certain individuals on given lists, so I use a
recipe something like this (ahead of the general recipe for that
mailing list):

        :0:
        * ^TO.*_such_and_such_a_list_
        * ^From:.*_such_and_such_a_person_
        /dev/null

as appropriate for the headers for each list.

    Normally, due to volume, I run with logging off once delivery
recipes are debugged, and this has not caused me any problems. 
However, for tracking purposes, I would like to log just those mails
that I am throwing into the bit bucket.  Some time ago, I tried the
following, which I would call in with

        INCLUDERC=bitbucket.rc

in place of the /dev/null action line:

    {
      # Turn on logging so we can record the action
      VERBOSE=off
      LOGABSTRACT=yes

      THEDATE=`formail -xDate:`  # When was it mailed?
      WHOFROM=`formail -xFrom:`  # Whom did this request come from?
      THESUBJ=`formail -xSubj:`  # What is the subject?

      :0c                        # Log the disposition
      # Splitting "" across lines is deliberate
      LOG="$THEDATE $WHOFROM $THESUBJ
"

      :0                         # Trash this piece of mail
      /dev/null

      # Reset logging to what it normally is for procmail
      VERBOSE=$VERBOSITY
      LOGABSTRACT=$LOGGING
    }

(For information, I usually control logging with variables so that I do
not have to remember to reset defaults all over the rc file.)

    Unfortunately, when I tried this method some time ago, it did not
work: it was throwing away everything destined for a given list!  Now
that I want to get back to it, I cannot figure out what I am doing
wrong.  I admit that I am not much of a procmail expert, and I do not
recall seeing anything quite like this in the man pages.

    Any help will be greatly appreciated.

Paul                             <pobart(_at_)access(_dot_)digex(_dot_)net>
----------------------------------------------------------
Paul O. Bartlett, P.O. Box 857, Vienna, VA 22183-0857, USA
Finger, keyserver, or WWW for PGP 2.6.2 public key 
Home Page:  http://www.access.digex.net/~pobart     

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