procmail
[Top] [All Lists]

Re: Verify Mail Has Valid 'From:' Field?

1998-01-19 01:47:04
On Sun Jan 18 23:50:58 PST 1998, David Hunt 
<david(_dot_)hunt(_at_)usa(_dot_)net>
wrote:
On Fri, 16 Jan 1998, Walter Dnes wrote:
FROMDOMAIN=`formail -rzxTo: | sed -e 's/.*@//'`
<...>
Further musings: I think one could strip the domain in any line containing
an address by piping to two sed calls.       |sed s/.*@//|sed s/'[ >,].*'//

You are free to give sed several lines of script, although that isn't
always feasible. In this case, it is:

    | sed -e 's/.*@//' -e 's/[ >,].*//'

If you're looking for the absolutely least resource-intensive way to
do this, it's even possible to do this extraction within Procmail:

    FROMDOMAIN=`formail ... whatever`
    :0
    * FROMDOMAIN ?? @\/[^@,     ]+
    { REALFROMDOMAIN="$MATCH" }

I don't think it would be impossible to do all of this within Procmail
(or within one bumper sed script, for that matter), but extremely hard
to get right. Wouldn't it be nice if we could have a standalone
address canonicalizer program? (Yeah, with yet another interpretation
of RFC822.) 

/* 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/>