A geek at home. A web and mobile Apps Developer at Bella Design in Cheshire. A man united fan all day long.

Rebuilding Linux qmail-queue

July 23rd, 2014

Has your mail server been hit with a spam bot? Or maybe you’ve just made the catastrophic mistake of deleting directories in the qmail queue directory

All current messages will be removed from the mail queue if you are following the steps below and cannot be restored

Stop the qmail service

service qmail stop (or) /etc/init.d/qmail stop

Then delete the folders under qmail queue and create the queue folder structure

cd /var/qmail/queue
rm -rf info intd local mess remote todo
mkdir mess

for i in seq 0 22; do mkdir -p mess/$i done

cp -r mess info
cp -r mess intd
cp -r mess local
cp -r mess remote
cp -r mess todo
chmod -R 750 mess todo
chmod -R qmailq:qmail mess todo intd
chmod -R 700 info intd local remote
chmod -R qmails:qmail info local remote

Start the qmail service

service qmail start (or) /etc/init.d/qmail start