procmail v3.10 under SunOS 4.1.4 I am working on a moderately
complex (for me) recipe with some nested nesting blocks. Within one of
those blocks I am trying to get the sender's email address user(_at_)domain
and see whether that address is in a file pointed to by variable
$USERLIST. The file of users is a single record in the format:
user1(_at_)domain1, user2(_at_)domain2, user3(_at_)domain3, etc. [commas for
real]
So far I have the following two recipe fragments:
# Find out whom it is from (incomplete)
:0
* ^From:.*\/[^ ].*
{ WHOFROM=$MATCH }
# Is this an eligible sender?
:0 w
| egrep -is $WHOFROM $USERLIST
I test the return code from the egrep as to which of two actions to
take (the sender is or is not in the user list file). I am not a grep
heavy, so I am uncertain whether this is the best way to make the test.
More importantly for this inquiry, the From: header on an incoming
mail could legally be in either of these two forms:
From: Foo Bar <user(_at_)domain>
From: user(_at_)domain
As the upper recipe above now stands, $WHOFROM could contain either
Foo Bar <user(_at_)domain>
user(_at_)domain
but I need to isolate the latter form. Otherwise the egrep will never
come up with a match, even if user(_at_)domain is in fact in the $USERLIST
file. So far I have not come up with any ideas for isolating just the
email address proper into variable $WHOFROM. All suggestions
gratefully received.
P.S. If a mail actually gets delivered to a real folder deep with
nested blocks, doesn't that terminate all processing all the way
back to the outer recipe of the .procmailrc file which "calls" all
those nested blocks? (That is my reading of the man page.)
Thanks very much.
Paul <pobart(_at_)access(_dot_)digex(_dot_)net>
----------------------------------------------------------
Paul O. Bartlett, P.O. Box 857, Vienna, VA 22183-0857, USA
Finger, keyserver, or WWW for PGP 2.6.2 public key
Home Page: http://www.access.digex.net/~pobart