Qmail Mail Stuck in the Queue

2008 Sept 6 at 07:18 » Tagged as :qmail, video,

The other day, staff at a company that I occaisionaly act as a consult for, were complaining about not having any mail. You would think that might make anyone happy but unfortunately they weren't.

When I checked their mail server (qmail + vpopmail + bincimap) which in fact I had setup for them sometime back, I found that thousands of messages were stuck in the queue without being placed into the inboxes. The good thing about qmail is that once the mail reaches the queue, it's safe. It will not go missing unless there is a hard drive failure.

Mails being stuck in the queue is quite common with qmail - usually though it's the remote deliveries that jam up - in this case it was the local deliveries. It turns out that qmail local had got stuck while placing messages in the postmaster's mailbox. With this setup whenever a message is recieved for a non existent user it's delivered to the postmaster (and a bouncer is given to the sender). In reality it wasn't such a smart thing to have done - no one bothers to check those messages and there were so many in Maildir/new that ls also seemed to crash. Even ls | wc didn't return a count.

The folder was completely deleted and qmail was configured to simply bounce those messages without placing a copy in the postmaster box. I also realized that it would be a good idea to use the good receipt to patch which I had used successfully on one my other mail servers.

The Good Receipt To patch (goodrcptto) results in the mail server rejecting emails to non existent users at the transaction stage - that makes life a lot easier for the mail server and saves quite a lot of bandwidth - it also makes the Double Bounce Trim (doublebouncetrim) patch redundant.