On Thu, 22 Jan 1998 07:33:21 -0500, KG
<FIMA_Institute(_at_)compuserve(_dot_)com>
wrote:
* ^TO_first(_at_)address(_dot_)com
*!^FROM_DAEMON
|perl $HOME/pgm.pl 123
<...>
I can generate such a file from my database:
first(_at_)address(_dot_)com\123
second(_at_)address(_dot_)com\456
third(_at_)address(_dot_)com\789
yougetthepicture(_at_)address(_dot_)com\other@mail.com
But how do I get procmail to work with it?
Massage the question a little bit: How would you access this list from
within a shell script?
The hard part is really matching with ^TO here because you need a copy
of the stuff you want to match on there -- you can't "extract" the
value of what ^TO matches because it can potentially match a lot of
things. (If you are content with matching, say, only "To:", then that
simplifies things in a way, although you then end up with the problem
of trimming down the match to just the e-mail terminus:
:0
WHAT=| formail -xzTo: | (something to canocicalize this to just \
the email terminus, precede with ^ and terminate with tab) \
| grep -f $HOME/db.txt
But I guess this is not really what you want here.)
The following is untested but might actually work. I have assumed you
use tab as field delimiter instead of backslash -- change something
accordingly.
ADDRS=`cut -f1 $HOME/db.txt | grep . | tr '\012' '|'`
# ^^^^^^ this is just to avoid accidents
:0c
* ! ^FROM_DAEMON
* $ ^TO\/($ADDRS)
| perl $HOME/new-pgm.pl "$MATCH"
... and change new-pgm so that it can fetch the right parameter from
the db.txt file instead of having Procmail do it, since it's probably
cheaper to do it that way.
/* era */
--
Paparazzi of the Net: No matter what you do to protect your privacy,
they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>