procmail
[Top] [All Lists]

Re: [Q] Managing forwardees

1996-11-05 23:54:01
On Tue, 05 Nov 1996 21:11:14 -0800 (PST), Robby Lee
<rylee(_at_)CSUPomona(_dot_)Edu> wrote:
     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
     }

The basic idea seems healthy to me, but I think it could be simplified
by making the map file line oriented -- say, tab delimited:

era     reriksso(_at_)cc(_dot_)helsinki(_dot_)fi
robby   rylee(_at_)CSUPomona(_dot_)Edu

and correspondingly

LIST=`cut -f1 list.txt`

and

FORWARDEE=`grep -i "^$USER      " list.txt | cut -f2`
                          ^^^^^^
                       this is a tab -- anchored search is safer

     # This doesn't allow for multiple receipients.

I think in fact it does, but I haven't tested. If FORWARDEE ends up
containing more than one address, Sendmail should nicely send the
message to all of them, no? 

Any comments would be appreciated.

Hope this helps,

/* era */

-- 
See <http://www.ling.helsinki.fi/~reriksso/> for mantra, disclaimer, etc.
* If you enjoy getting spam, I'd appreciate it if you'd register yourself
  at the following URL:  <http://www.ling.helsinki.fi/~reriksso/spam.html>

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