On Mon, 2 Jun 1997 14:45:40 -0700 (MST),
Wotan <wotan(_at_)netcom(_dot_)com> wrote:
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 }
| I do not have any form of nws in my FOLKS listing ...
Well, I ansered both of my questions. David's rc does not give the same
value for $SENDER. Which makes it less useful for too me, since it
doesn't use the reply-to address.
What I think David was trying to say was that you can say
FROM=`$FORMAIL -zrx To:`
:0
FROM ?? ^^\/[^(_at_)]+
{ SENDER=$MATCH }
and I get the feeling you didn't understand it quite this way, is this
correct?
And you have previously set FROM to something using $FORMAIL -rtzxTo:?
Then your comments start to make sense.
Yes, the formail trick to get the From: address is no good if you
positively always want to get the From: address (and not reply-to
etc). The purpose of formail -r is precisely to get a good reply
address, based on the best available information in the headers. If
you always want the From: field, nothing could be (much) easier:
:0
* ^From:[ ]*\/[^ ].*
{ FROM=$MATCH }
This will of course grab all of the From: field. If you want to strip
it down to just the address part, it complicates matters a little bit.
Here's an idea: Since formail -rtzx will do the actual parsing for
you, you could do this:
:0
FROM= | formail -XFrom: | formail -rzxTo:
(Now wait for one of the people with a photographic memory of the
formail source to come up with a way to do this with a single formail
invocation.)
The old drudgy way to parse it entirely within Procmail (which is
never going to be 100% perfect) would be something like
:0
* ^From:(.*\<)?\/[^ <>@]+(_at_)[^<> @]+
{ FROM=$MATCH }
This assumes you have a FQDN address with an @ in it, and no comments
in the address with @:s in them. The whitespace in the brackets, as
usual, consists of a tab and a space.
Hope this helps,
/* era */
--
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r. <http://www.iki.fi/~era/>
* Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>