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:
- /var/qmail/bin/qmail-qstat
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:
- /var/qmail/bin/qmail-qread
Sample Output:
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 test.com
Replace
test.com 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 [email protected]
- 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/71978662.info
- 71970942: no
- 71977906: no
- 1 file(s) match
- [root@server ~]#
6. Mailbox location (In Plesk)
That’s it!