I grew tired of getting daily cron reports about messages in my qmail queue with empty envelope from's (at least, I think thats what its called), so I wrote this short script to modify the output of mailq. I just pipe mailq's output through my script. This cuts the size of my daily messages from 50-60kb to 5-6k, with (I feel) no loss of information.
Suggestions and the like are always welcome.
Regards, -- Dave Steinberg http://www.geekisp.com
===== CUT HERE =====
#!/usr/bin/perl -w
# Copyright (c) Dave Steinberg, 2003. This script is in the public domain.
# Reformat the output of qmailctl queue (or mailq, same thing) to spam me less.
#
# The lines come in such that each part of a new message is tabed or whitespaced in
# a bit, so we can use that to piece together all the info for a particular message.
#
use strict;
my $msg_count = 0;
my $buf = '';
my $empty_envelope_count = 0;
my $empty_envelope_flag = 0;
while (my $line = <STDIN>) {
if ($line =~ /^[0-9]/) {
print $buf; # print the previously accumulated data # start of a new message
$msg_count++;
$empty_envelope_flag = 0;
$buf = $line;
if ($line =~ /<>.*$/) {
$empty_envelope_count++;
$empty_envelope_flag++;
$buf = '';
}
} else {
next if ($empty_envelope_flag);
# same message, multiple recipients
$buf .= $line;
}
}print STDOUT <<EOS; Messages in queue: $msg_count Messages with empty envelope from: $empty_envelope_count EOS ====== END OF SCRIPT ===== _____________________________________________ tmda-users mailing list ([EMAIL PROTECTED]) http://tmda.net/lists/listinfo/tmda-users
