procmail
[Top] [All Lists]

Re: Carbon copy for each TO

1997-04-30 15:01:00
On Wed, 30 Apr 1997, Philip Guenther wrote:

Is there an similar technique to LASTFOLDER for testing if a message has
been forwarded such as: 

        :0 c:
        * ^TO.*\<bob\>
        ! bob(_at_)mail(_dot_)com

This does not appear to set any flags?

- Liston


Anyway, the following should illustrate:

      # Clear the indication of whether delivery has taken place
      # (this is in case there are recipes with the 'c' flag above
      # this.
      LASTFOLDER

      :0 c:
      * ^TObob\>
      bob

      :0 c:
      * ^From.*\<bob\>
      from-bob

      :0 c:
      * ^TObill\>
      bill

      # If one of the previous 3 recipes was invoked, LASTFOLDER will
      # now be set.  To check that we use David Tamkin's ${LF+!}
      # trick:  if LASTFOLDER is set, ${LASTFOLDER+!} expands to a '!',
      # while if it's not set, it expands to nothing.  The condition
      # below will 'match' (be true) iff LASTFOLDER was set.  We'll
      # then drop the message as already handled, and let the rest of
      # the .procmailrc handle those messages which haven't already
      # been delivered, possibly via the implicit delivery to
      # $DEFAULT.  Yes, this is the reverse of what you originally
      # proposed, but it's usually more flexible this way.  Remember
      # that the null regexp always matches.
      :0:
      * $ ! ${LASTFOLDER+!}
      {
          # drop the message as already delivered
          HOST
      }


============================================================================
- Liston Bias                        When one door closes, another opens,
  Alumni of Oklahoma State Univ      but we often look so long and
  Alumni of Florida State Univ       regretfully upon the closed door, we
                                     do not see the ones which open for us.
  bias(_at_)pobox(_dot_)com                                        -A.G. Bell
  http://www.pobox.com/~bias
============================================================================


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