On Sun, 10 Mar 1996 04:52:16 -0800, Joe Pruett <joey(_at_)teleport(_dot_)com>
wrote:
we use procmail for local delivery, and would like to get it to generate
the content-length header, if one doesn't exist. mailtool at least gets
confused and merges messages together if there is no message body. i
can't seem to find a way to make that happen, nor can i seem to figure
out a way to make a procmailrc rule via formail to do it, either.
Actually, I'd love to have a mechanism to get a message's length in
lines from Procmail itself. I've been trying to filter unsubscribe
messages according to different criteria, but the one thing I think
would catch nearly all would be the length of the message proper: If
it's less than four lines sans .sig and headers, and it's directed to
a list, and [optionally] it contains any typical "how do I
unsubscribe" phrase, it's a stupid question and I want to kill it.
(Other good rules which work some of the time: No Subject at all
[roughly equivalent to "^X-Mailer: Mozilla.*" ;^] and a subject line
with "unsub" or "haaalp!!!!!" in it ...)
I've been trying to use the >nnn type of recipe but it's not really
efficient. I receive messages which are <1000 bytes which are not
unsubscribe requests, and some messages >2000 bytes are unsubscribes.
any clues from out there?
I haven't tried this, but here's a simplistic Perl script:
#!/usr/local/bin/perl -s
# This is one of those rare cases where awk might actually feel more natural
while (<>)
{
if (!$body)
{
next unless m/^$/; # First empty line is end of header
$body = 1;
next;
}
else
{
last if m/^-- $/ && $no_sig; # If -no_sig switch, skip .signature
$i++;
}
print "$i\n";
}
/* era */
--
See <http://www.ling.helsinki.fi/~reriksso/> for mantra, disclaimer, etc.