Qmail flush stuck queue

Qmail is a wonderful MTA in all sense but its quite easy to have the troubles like your queue getting filled up and you don’t know how to flush the queue. I’ll give you some insights how to do that

If you have already downloaded qmHandle you can remove the mails by issuing the command

qmHandle -S'failure notice'

Here we have deleted all the mails with the subject “failure notice” change it as per your needs, but I don’t think qmHandle can work on a busy system and when the queue is quite large. By default qmHandle has to stop qmail first so make sure that qmailctl is correctly mentioned in the qmHandle script just another tip 🙂

Our installation of qmail was based on qmailrocks and here is the method we followed

You cannot simply stop qmail by issuing qmailctl stop

you need to stop by the command

svc -d /service/*
svc -d /service/*/log

then kill all  process

pgrep |xargs kill -9

now go to queue directory

cd /var/qmail/queue/ find mess -type f -exec rm -rf {} ;
find info -type f -exec rm -rf {} ;
find remote -type f -exec rm -rf {} ;

Now enable service

svc -u /service/*
svc -u /service/*/log

now tail the log files

 tail -f /var/log/qmail/qmail-smtpd/current also tail -f /var/log/qmail/qmail-send/current and see how it goes.