procmail
[Top] [All Lists]

Re: What's wrong with...

1996-11-05 01:00:05
    > Could one tell me what's wrong with the rule:
    > 
    > :0:
    > * ^TOwww-html(-request)?(_at_)w3(_dot_)org
    > mail/www-html.spool
    > 
    > ...beyond the fact that it doesn't catch a mail with the following
    > header fields (I prefixed the first one with '>'), should it?:
    > 
    > >To: sophia-listes-www-html(_at_)news-sop(_dot_)inria(_dot_)fr
    > X-List-Url: http://www.w3.org/pub/WWW/Archives/Public/www-html/
    > Resent-From: www-html(_at_)w3(_dot_)org
    > X-Mailing-List: <www-html(_at_)w3(_dot_)org> archive/latest/6710
    > X-Loop: www-html(_at_)w3(_dot_)org
    > Sender: www-html-request(_at_)w3(_dot_)org
    > Resent-Sender: www-html-request(_at_)w3(_dot_)org
    > 
    > Thanks for your insights (I do hope that it is obvious)!

The ^TO macro matches the *recipient* fields: To:, Cc:, Bcc:,
Apparently-To:. 

The mail header above is apparently *from* the www-html(_at_)w3(_dot_)org list, 
not
*to* it.  If you wish to file mail from the list, use the following rule:

    PRE_ADDR_SPAN="(.*[^a-zA-Z0-9._-])?"
    FROM="(^(((Resent-)?(Reply-To|From|Sender)|X-Envelope-From):|>?From 
)$PRE_ADDR_SPAN)"

    :0:
    * $ $FROM(www-html(-request)?(_at_)w3(_dot_)org)
    mail/www-html.spool

Of course, you do not need to use the FROM variable if you place the
regular expression directly on the condition line.  

On the other hand, using $FROM makes the recipe condition more readable,
and I find it very convenient to have the FROM and PRE_ADDR_SPAN defined
in a procmail library file which I keep handy for situations like this.
That way, I don't have to remember the details.

If you would like a copy of my procmail library, just send me an email
with the subject "send procmail library", or browse my web page under
the "mail" links.

Enjoy.
___________________________________________________________
Alan Stebbens <aks(_at_)sgi(_dot_)com>      http://reality.sgi.com/aks

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