1#!/usr/bin/perl
2
3$REGEXP = shift || die "no email-adress given (regexp-style, e.g. bl.*\@yahoo.com)!";
4
5@data = qx</usr/sbin/postqueue -p>;
6for (@data) {
7 if (/^(\w+)(\*|\!)?\s/) {
8 $queue_id = $1;
9 }
10 if($queue_id) {
11 if (/$REGEXP/i) {
12 $Q{$queue_id} = 1;
13 $queue_id = "";
14 }
15 }
16}
17
18#open(POSTSUPER,"|cat") || die "couldn't open postsuper" ;
19open(POSTSUPER,"|postsuper -d -") || die "couldn't open postsuper" ;
20
21foreach (keys %Q) {
22 print POSTSUPER "$_\n";
23};
24close(POSTSUPER);