On Tue, Feb 26, 2013 at 12:25 AM, Shrinivasan T <tshrinivasan at
gmail.com>wrote:
Qmail is one of the famous open source email servers like postfix,
sendemail, exim etc.
Today, got a qmail server which was very slow in sending emails.
It took even 24 hours to send an email.
Let us see here, how to solve this issue.
Spam mails are the major reason on slowness of any email server.
First we have to check the email queue to know how many mails are
there to be processed.
# /var/qmail/bin/qmail-qstat
messages in queue: 23645
messages in queue but not yet preprocessed: 82
ooops.
23645 mails in the queue is a huge number.
The next step is to use is ?qmail-qread?, which can be used to read
the message headers:
# /var/qmail/bin/qmail-qread
18 Jul 2005 15:03:07 GMT #2996948 9073 <user at domain.com> bouncing
done remote user1 at domain1.com
done remote user2 at domain2.com
done remote user3 at domain3.com
23 Feb 2013 22:52:24 GMT #13633871 2239 <ef6276 at gmail.com> bouncing
remote cnsccorp at marinecorps.com
done remote cnsccorp at netzero.net
done remote cnsccorp at verizon.com
done remote cnsccorp at verizon.net
remote cnsccorp at yahoo.com
remote cnscenic at flash.net
....
I see here that there are many emails from the email address
ef6276 at gmail.com
where all the mails contain bogus TO address.
So, all these mails are SPAM mails and can be deleted.
Let us count how many spam mails are there.
qmHandle is a nice tool to handle the email queue in the qmail.
using this, we can list the queue, send all the mails in the queue,
delete the mails using any field like sender, receiver, domain,
subject, body text even using regular expression.
options for qmandle
-l to list the queue
-s to summarize the queue
-a to send all emails
-fsender to delete emails from sender
/usr/local/src/qmhandle-1.3.2/qmHandle -l | grep From | grep ef6276 | wc -l
22735
So, there are 22735 spam mails that are generated from single email
address ef6276 at gmail.com
Let us delete them all.
/usr/local/src/qmhandle-1.3.2/qmHandle -fef6276 at gmail.com
It took some 30 min to delete all the spam emails.
Let us check the queue status now.
/usr/local/src/qmhandle-1.3.2/qmHandle -s
Total messages: 910
Messages with local recipients: 0
Messages with remote recipients: 910
Messages with bounces: 10
Messages in preprocess: 0
So, there are 910 valid emails
Let us try to send them all.
/usr/local/src/qmhandle-1.3.2/qmHandle -a
That's all.
In some 30 minutes, all the valid emails are sent and the email server
started to breath easily.
Thanks to the following links which helped me to know about qmail.
http://blog.xfloyd.net/?p=109
http://pc-freak.net/blog/how-to-fix-a-broken-qmail-queue-with-queue-repair-and-qmhandle/
http://linuxhostingsupport.net/blog/howto-manage-mail-queue-in-qmail-using-qmhandle
http://lateral.netmanagers.com.ar/stories/8.htm<http://lateral.netmanagers.com.ar/stories/8.html>