procmail
[Top] [All Lists]

Re: Match X but not Y if is also there

2001-12-02 00:18:21
Sorry about that.  I figured it would be best to save a bit of bandwidth
and not include two almost identical recipes and just point out the minor
differences.  Here's the two recipes that I'm working on right now.

LOGFILE=/tmp/log
VERBOSE=yes
#  --  broadwing.net
:0c
*     ^Received:.*\<broadwing\.net\>
* !   ^Received:.*\<netzero\.net\>
* $ ! ^X-Loop: $ABUSE
{
        :0f
        | formail -I"X-Spam: broadwing.net" \
        -I"X-Loop: $ABUSE"

        :0:
        /var/spool/mail/quarantine/spam/broadwing.net
}
#  --  broadwing.net

#  --  advertising.com
# I removed the clone option here cause it appears to be working fine.
:0BH
* advertising.com
* $ ! ^X-Loop: $ABUSE
{
        :0f
        | formail -I "X-Spam: advertising.com" \
        -I"X-Loop: $ABUSE"

        :0:
        /var/spool/mail/quarantine/spam/advertising.com
}
#  --  advertising.com
VERBOSE=no
LOGFILE=/var/log/procmail.log


I believe I also fixed the major problem with the advertising.com filter.
I had the ! before the $ (although I didn't realize the significance of
the $ until you mentioned expanding and used it in your example--I'd just
used it in a similar match).  I just tested it by bouncing two messages,
identical except for one has X-Loop and X-Spam and one doesn't, from one
account to another local account and it worked as expected.  In the past
I've always relied on resending mail to test a recipe rather than parsing
an existing spool.  I don't suppose there's much difference either way.

For the time being, I'm wanting to clone the messages that I match and add
the X-Loop and X-Spam headers to.  I figure I'll do that until I'm sure
I've cut out my false positives.

My advertising.com is working as expected now.  My broadwing.net one has
ceased to function.  The Received: lines above for matching broadwing.net
and not netzero.net don't make any matches.  I've reverted back this for
now.

* ? formail -x"Received:" | egrep -is "broadwing.net"
* ! ? formail -x"Received:" | egrep -is "netzero.net"


I also made the log for both recipes verbose.  Now I'm seeing this in the
log

procmail: [13150] Sun Dec  2 01:05:15 2001
procmail: Executing " formail -x"Received:" | egrep -is "broadwing.net""
procmail: [13150] Sun Dec  2 01:05:15 2001
procmail: Non-zero exitcode (1) from " formail -x"Received:" | egrep -is
"broadwing.net""
procmail: No match on " formail -x"Received:" | egrep -is "broadwing.net""
procmail: [13150] Sun Dec  2 01:05:16 2001
procmail: No match on "advertising.com"
procmail: Assigning "VERBOSE=no"


I now get this for both of my test messages (with and without the X-Spam
and X-Loop) and inbound mail on my system.  I'm not sure what broke it but
it broke.

I'm too tired to think about this right now so I'm going to sleep on it.
Perhaps the holdup will be obvious in the morning.  Thanks fro the
assistance

Justin

_______________________________________________
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>