procmail
[Top] [All Lists]

Re: Failure of fgrep?

1997-06-04 12:50:00
I made a suggestion to wotan(_at_)netcom(_dot_)com,

| On Mon, 2 Jun 1997, David W. Tamkin wrote:
| 
| > wotan(_at_)netcom(_dot_)com wrote,
| > 
| > | FROM=`$FORMAIL -zrx To:`
| > | SENDER=`echo $FROM | sed -e 's/@.*//'`
| > 
| > You could do the second step within procmail and save overhead:
| >                  ^^^^^^
| >  :0
| >  * FROM ?? ^^\/[^(_at_)]+
| >  { SENDER=$MATCH }

who replied thus:

| Does this allow me to grab the correct Reply-to information?  The address
| from formail -r is the one I base my filtering on.  

Note that I said that the recipe was a replacement for the *second* step.
Your first step -- assuming that $FORMAIL points to a working version of
formail -- remains intact to figure the return address with formail's normal
precedences and to put it into $FROM.  My suggested recipe tests the contents
of $FROM -- which should derive from Reply-To: when there is a Reply-To: --
and extracts the useful part into $SENDER. 

And you do understand that "^@" meant caret+at and not ctrl-@, I hope!

Note that if you are using an old version of formail, formail -r (without -t)
may prefer From_ to Reply-To:.  But I think those versions would be too old
to support -z.

You could also combine the two this way if you have no other need for $FROM:

 SENDER=`$FORMAIL -rzxTo: | sed 's/@.*//'`

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