procmail
[Top] [All Lists]

[Q] Managing forwardees

1996-11-05 22:41:27

Is there a better way to manage multiple mail forwarding as follows?

        USERS="(A001|A002|A003)"        #and so on

        :0
        * $^TO_$USERS
        {
          :0c
          * ^TO_a001
          ! B1(_at_)domain(_dot_)com

          #. and so on

          :0
          * ^TO_a003
          ! B3(_at_)domain(_dot_)com
        }

My question is, I'm doing this manually (adding|changing|deleting)
but, is it possible to use some sort of file to manage this??

e.g. filename "list.txt" contains the following.

        A001
        B1(_at_)domain(_dot_)com
        A002
        B2(_at_)domain(_dot_)com
        ...etc.

Now the receipe.

        LIST=`egrep '^[^@ ]+$' list.txt`
        USERS=`echo $LIST | sed 's/  /|/g'`

        :0
        * $^TO_\/($USERS)
        { USER=$MATCH
          FORWARDEE=`grep -A 1 -wi $USER list.txt | tail -1`
          :0
          ! $FORWARDEE
        }

        # This doesn't allow for multiple receipients.

Any comments would be appreciated.

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