SPAM mail removal script
Step:- 01
root@mail:/root# vi /root/removemail#!/usr/bin/perl
$REGEXP = shift || die "no email-adress given (regexp-style, e.g. bl.*\@yahoo.co
@data = qx</opt/zimbra/common/sbin/postqueue -p>;
for (@data) {
if (/^(\w+)(\*|\!)?\s/) {
$queue_id = $1;
}
if($queue_id) {
if (/$REGEXP/i) {
$Q{$queue_id} = 1;
$queue_id = "";
}
}
}
#open(POSTSUPER,"|cat") || die "couldn't open postsuper" ;
open(POSTSUPER,"|/opt/zimbra/common/sbin/postsuper -d -") || die "couldn't open postsuper
foreach (keys %Q) {
print POSTSUPER "$_\n";
};
close(POSTSUPER);
Step:-02
root@mail:/root# chmod +x /root/removemail
Step:-03
root@mail:/root#/root/removemail <spammer address>
Comments
Post a Comment