# Routine for extracting the UTC timestamp from message ID
# lifted from eximstat utility
-# Version 1.1
+# Version 1.2
use strict;
+BEGIN { pop @INC if $INC[-1] eq '.' };
use Getopt::Std;
# Have this variable point to your exim binary.
$base = 62;
};
-getopts('hf:r:y:o:s:zxlibRc',\%opt);
+getopts('hf:r:y:o:s:C:zxlibRca',\%opt);
+if ($ARGV[0]) { &help; exit;}
if ($opt{h}) { &help; exit;}
+if ($opt{a}) { $eargs = '-bp'; }
+if ($opt{C} && -e $opt{C} && -f $opt{C} && -R $opt{C}) { $eargs .= ' -C '.$opt{C}; }
# Read message queue output into hash
&collect();
Exim message queue display utility.
-h This help message.
+ -C Specify which exim.conf to use.
Selection criteria:
-f <regexp> Match sender address sender (field is "< >" wrapped)
-i Message IDs only
-b Brief Format
-R Reverse order
+ -a All recipients (including delivered)
EOF
}
sub collect() {
- open(QUEUE,"$exim $eargs |") or die("Error openning pipe: $!\n");
+ open(QUEUE,"$exim $eargs |") or die("Error opening pipe: $!\n");
while(<QUEUE>) {
chomp();
my $line = $_;
foreach my $msg (keys(%id)) {
if ($opt{f}) {
# Match sender address
- next unless ($id{$msg}{from} =~ /$opt{f}/);
+ next unless ($id{$msg}{from} =~ /$opt{f}/i);
}
if ($opt{r}) {
# Match any recipient address
my $match = 0;
foreach my $rcpt (@{$id{$msg}{rcpt}}) {
- $match++ if ($rcpt =~ /$opt{r}/);
+ $match++ if ($rcpt =~ /$opt{r}/i);
}
next unless ($match);
}