Path adjusted though for /opt/zimbra/common/sbin/*
Creat a Perl script with name: “delete-from-mailq”:
#!/usr/bin/perl $REGEXP = shift || die “no email-adress given (regexp-style, e.g. bl.*\@yahoo.com)!”; @data = qx; for (@data) { if (/^(\w+)(\*|\!)?\s/) { $queue_id = $1; } if($queue_id) { if (/$REGEXP/i) { $Q{$queue_id} = 1; $queue_id = “”; } } } open(POSTSUPER,”|/opt/zimbra/common/sbin/postsuper -d -”) || die “couldn’t open postsuper” ; foreach (keys %Q) { print POSTSUPER “$_\n”; }; close(POSTSUPER);
Save the above script to a file say “delete-queue.pl” in your home directory, and make it excutable:
chmod 755 delete-queue
Usage – Run as root :
- Delete all queued messages from or to the domain “abc.com”
./delete-queue abc.com
- Delete all queued messages to specific address “spammer@mydomain.com”
./delete-queue bogususer@mydomain.com
- Delete all queued messages that begin with the word “bush” in the e-mail address:
./delete-queue bush*\@whateverdomain.com
- Delete all queued messages that contain the word “biz” in the e-mail address:
./delete-queue biz
Mình lập blog này với mục đích lưu lại + chia sẻ các các kiến thức mình đã biết hoặc đang tìm hiểu. Cơ bản giúp ích cho mình 🙂 Nhưng hy vọng sẽ mang lại sự khởi đầu thuận lợi cho người mới bắt đầu!