Mail Servers

Useful Qmail Commands

useful qmail commands
Qmail Commands

Useful Qmail Commands

This post discussing some useful Qmail Commands. It will help to troubleshoot the email issues on a Qmail server. Plesk Control Panel supports two Mail Transfer Agents (MTA). They are Postfix and Qmail.

Check some important Qmail commands below:

1. To get the count of the messages in the queue:


Sample Output:

[root@server ~]# /var/qmail/bin/qmail-qstat 
messages in queue: 9
messages in queue but not yet preprocessed: 0
[root@server ~]#

2. To list the messages in the queue:


Sample Output:

[root@server ~]# /var/qmail/bin/qmail-qread
26 Jun 2018 15:51:11 GMT #71978662 15982 <> 
25 Jun 2018 11:58:36 GMT #71977906 31600 <> 
25 Jun 2018 14:30:53 GMT #71978461 9279 <> 
30 Jun 2018 10:56:26 GMT #71970942 4336 <> 
28 Jun 2018 10:21:22 GMT #71977085 23003 <> 
[root@server ~]#

3. To read the contents of an email

find /var/qmail/queue -name MAIL_ID | xargs cat | less

Replace MAIL_ID with the 8 digit ID in the output of /var/qmail/bin/qmail-qread command.

4. To remove all emails from the queue

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 {} \;

5. To remove specific emails from the mail queue

qmail-remove -r -p

Replace with the desired string. Also, please note if the qmail-remove command doesn’t exist on your server, you need to install it.

Sample Output:

[root@server ~]# qmail-remove -r -p
71978652: no
71977085: no
71977087: no
71970929: no
71978461: no
71977020: no
71978662: yes
moved mess/1/71978662 to yanked/71978662.mess
moved remote/1/71978662 to yanked/71978662.remote
moved info/1/71978662 to yanked/
71970942: no
71977906: no
1 file(s) match
[root@server ~]#

6. Mailbox location (In Plesk)


That’s it!

Also Read:

If you like this post and wish to receive more articles from us, please like our FB page: GrepItOut

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at

1 Comment

Click here to post a comment