procmail
[Top] [All Lists]

Re: How to?

1997-05-13 19:56:00
Erdem Ozsaruhan <eozsaruh(_at_)nsf(_dot_)gov> writes:
I want to be able to send a message to user1 if a message has a
subject with TEST1 in it and the message comes from testuser.

But if the massage has a Subject line with TEST1 in it but does not
come from testuser, I want to send a message to user2.

And if the subject does not have TEST1 in it regardles where it comes
from, I want the message go to the $DEFAULT and to user3.

Is this possible?

something like:

DEFAULT=$HOME/mbox

:0            
* ^Subject:.*TEST1*
{
      * ^From.*testuser*   (I know this is not allowed, that's my problem!)
      :0
      !user1
      :0 E
      !user2
}

And somewhere I have to use !user3 ...

Almost had it.  Your largest problem was that you missed the placement of
the condition on the nested recipe.  Remember: inside the braces is just
a normal series of recipes and assignments:

        DEFAULT = $HOME/mbox
        :0
        * ^Subject:.*TEST1
        {
            # Use \< and \> to delineate the address so that "testuser2"
            # doesn't match.
            :0
            * ^From.*\<testuser\>
            ! user1

            # If that didn't match, send it to user2.  If it did, we wouldn't
            # be here at all, so no need for the 'E' flag.
            :0
            ! user2
        }

        # send a copy of user3
        :0 c
        ! user3


Does that all make sense?

Philip Guenther

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