Script to Remove Over Quota Message from Zimbra Queue

Sometimes we have a bunch of over quota message filling up Zimbra queue, with detail as below :
197CF170F9 59761 Wed Oct 24 09:49:48
(host[] said: 452-4.2.2 The email account that you tried to reach is over quota. Please direct 452-4.2.2 the recipient to 452 4.2.2 m3-v6si2776998pld.435 – gsmtp (in reply to RCPT TO command))
The email message will be automatically removed from the queue after a while, depending on our queue lifetime setting on the server. If we want to automatically remove on the selected time interval, we can then set up crontab to run the following script :
[code lang=”bash”]
/opt/zimbra/postfix/sbin/postqueue -p | grep -A 1 “over quota” | grep @ | sort | uniq > /tmp/over-quota.txt
USERS=`cat /tmp/over-quota.txt`
echo “Looping for all users”
for ACCOUNT in $USERS; do
#Remove over quota queue
echo “Account over quota : $ACCOUNT”
pfdel $ACCOUNT
echo “”
echo “All over quota queue has been removed successfully”
The above script is run together with pfdel script, so don’t forget to download and save pfdel script as well.

Leave a Reply

Your email address will not be published. Required fields are marked *