How to manage Qmail queue in Linux Plesk

Plesk server uses qmail as a mail server. Following are some of the qmail commands for Plesk server.
1) To check the mail queue in plesk from command line, you can use the command :
# /var/qmail/bin/qmail-qstat
messages in queue: 10
messages in queue but not yet preprocessed: 0

2) You can examine the queue with qmail-qread.
# /var/qmail/bin/qmail-qread

3) From the qread command you get the messages id .
In the above example , one of the id is 524514 . Now you can find the file holding the email in/var/qmail/queue with find command.
# find /var/qmail/queue -iname 524514

4) From the mail header you get the IP address.
# vi /var/qmail/queue/mess/22/524514
# /etc/init.d/qmail stop (Stop qmail before removing)
# /var/qmail/bin/qmail-remove -r -p Time Passing

The above steps can be used to track Spammers .
Do you wish to completely remove all the mails from queue? Just run the below commands.

find /var/qmail/queue/mess -type f -exec rm {} \;
find /var/qmail/queue/info -type f -exec rm {} \;
find /var/qmail/queue/local -type f -exec rm {} \;
find /var/qmail/queue/intd -type f -exec rm {} \;
find /var/qmail/queue/todo -type f -exec rm {} \;
find /var/qmail/queue/remote -type f -exec rm {} \;


Leave a Reply