procmail
[Top] [All Lists]

Re: procmail blues: half-shod solution...

2002-12-29 14:41:37
PSE-L(_at_)mail(_dot_)professional(_dot_)org (Professional Software 
Engineering) wrote:

the From_ line should contain their email 
address as the first component following the header, and procmail can 
extract that internally like so:

:0
* ^From[        ]+\/[^  ]+
{
         FROMADDR=$MATCH
}


While that's fine, I'd note that the From_ line should never have a tab
in it, and should have exactly one space before the start of the address.
I have $WS predefined as a var comprising a space and a tab, and use
it throught my .procmailrc; but the one exception is when I'm coding
for regex matches in the From_ ("address From") line.  Then I don't
bother to make allowances for what should never appear (i.e., a tab,
or multiple spaces).  I'd write this:

        :0  # inside the square braces are a caret and a space.
        * ^^From \/[^ ]+
        { FROMADDR = $MATCH }

Note the ^^, because we're only interested in the first line of the mail
headers.

-- 
dman


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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