procmail
[Top] [All Lists]

Re: Extraneous Lockfile & Exitcode

2002-05-21 09:44:03
At 18:57 2002-05-20 -0500, Aaron Schrab did say:

No, I mean that your previous reply (the one with Message-ID
5(_dot_)1(_dot_)0(_dot_)14(_dot_)2(_dot_)20020520103843(_dot_)07724bd0(_at_)mail(_dot_)professional(_dot_)org).
  It's ironic
because the very message in which you described a way of determining
that a reply isn't spam would have failed the very test that it
described.

Why?

Received and Content-Type both get split across multiple lines. Procmail and formail comprehend them (and this "broken" header too) just fine. The only appreciable difference is that those headers have the benefit of being comprised of muliple words, where the insertion of the continuation indent doesn't significantly impact parsing (it is just whitespace - but it might be a tab instead of a single space, which could impact some poorly written regexps).

With the In-Reply-To: header, the continuation indent - that space - ends up sticking around after the header has been reassembled by Procmail or formail - just as it would if it were the continuation indent in a Received header.

It is easy to solve this in a procmail script, using the tools commonly employed in this forum:

# No doubt could be made more efficient, but this gets the job done - it
# will handle multiple lines.  If all you expect is to deal with a single
# break, just use sed 'N;s/\n[  ]*//'
INREPLYTO=`formail -zxIn-Reply-To: | sed '/./{:top
N;s/\n[   ]*//
btop
}'`

:0
* ! INREPLYTO ?? ^^^^
* ? grep -q $INREPLYTO mymessages.log
{
        # matches one of ours, handle it as you would a non-spam.
}

Same goes for References:. Rather than maintaining a flat db of messageids (you'd need to BCC yourself and have a filter grabbing the data, or have a MTA config to invoke a rule on sent messages), you could just regexp grep the INREPLTO or REFERENCES for your own domain portion and assume if it's there that it's a reply to something you wrote. Replace the above conditions with:

* 9876543210^0 INREPLYTO ?? winery\.garlic\.com
* 9876543210^0 REFERENCES ?? winery\.garlic\.com

(assuming a similar header extract for REFERENCES)

As I've already said, expecting the headers to be there isn't going to net you a 100% since not all client programs will include them, but it beats the heck out of simply throwing away ALL mail addressed to oneself at the address you use when communicating in public forums.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

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