procmail
[Top] [All Lists]

Re: How to match on empty body?

1996-10-14 10:48:13
Rick Troxel <rick(_at_)helix(_dot_)nih(_dot_)gov> writes:
Is there a recipe for detecting messages in which the body is empty?
The following recipe doesn't work, because (according to the verbose
log) the "< 2" condition doesn't match.

 :0
 * ^From.*(root|backup)
 * ^TOroot
 {
 # Delete all having no message, no subject
   :0
   * ! ^Subject:
   {
     :0B
     * < 2
     /dev/null
   }
 # Other stuff deleted
 }

What version of procmail is this with?  The HISTORY file mentions a
bug in the handling of '<' and '>' conditions when it was applied to
variables, but that may also effect it's handling of the B and H flags:

1995/10/29: v3.11pre4
            Changes to procmail:
               - varname ?? < nnn conditions didn't have the expected effect


Alternatively, the following should work:


   {
     :0
     * B ?? ^^(..?)?^^
     /dev/null
   >


The '^^' token matches either the very beginning or the very end of the
string being matched, here, the body of the message.

Philip Guenther

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