On Mon, Mar 09, 2009 at 03:55:11PM +1100, Nigel Allen wrote:
Hi
I am aware of how the basic whitelisting works from the docs on the web
thus:
# whitelist
FGREP=/usr/bin/fgrep
FROM=`formail -x From:`
DEFAULT=/var/mail/cannon
:0E
* ? (echo "$FROM" | $FGREP -i -f $HOME/ok)
${DEFAULT}
However I need to do something a little different. I need to extract a
customer header and look for it in a text file - so far so good. I then
need to return a token from the file. For example, if my header contains
001 and the file contains:
001:fred
002:jim
I need to return the value "fred" back to my recipe.
The following assumes that the header key will never contain a :, and
the key/value map is : delimited, and values are never empty.
AWK=/usr/bin/awk
KEY=`formail -x X-The-Header:` # or whatever
VAL=`$AWK "BEGIN { FS=\":\" } /^$KEY:/ { print \$2 }" < $HOME/valuemap`
:0
* VAL ?? .+ # key matched
{
# use $VAL somehow
}
Untested, but should at least get you on the path.
Ed
signature.txt
Description: Digital signature
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail