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:
/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:
[root@server ~]# /var/qmail/bin/qmail-qread 26 Jun 2018 15:51:11 GMT #71978662 15982 <> remote test@grepitout.com 25 Jun 2018 11:58:36 GMT #71977906 31600 <> remote test2@grepitout.com 25 Jun 2018 14:30:53 GMT #71978461 9279 <> remote test3@grepitout.com 30 Jun 2018 10:56:26 GMT #71970942 4336 <> remote test4@grepitout.com 28 Jun 2018 10:21:22 GMT #71977085 23003 <> remote test5@grepitout.com [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 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 test@grepitout.com 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)
/var/qmail/mailnames/
That’s it!
Also Read:
- Useful Exim Commands
- Useful Postfix commands
- Block outgoing email of a domain in Plesk – Postfix
- Change outgoing mail server IP address in Plesk
- How to migrate emails using imapsync tool
- Exim Mail queue monitoring Script
- How to Install Mailspring on Ubuntu (Mail App)
- How to block outgoing emails of an account in cPanel
- Create email account in cPanel via terminal
- Change outgoing mail server IP address in Plesk
- Linux Mint Wallpapers Download (Free)
- How to Block Traffic by Country using CSF Firewall
- How to Install Sublime Text on Ubuntu and CentOS
- How to Install Wiznote on Ubuntu (Evernote Alternative)
- Error: /usr/local/cpanel/bin/jailshell: /usr/bin/wget: Permission denied
- Install UFW Firewall on Ubuntu or Debian based distros
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 info@grepitout.com
[…] Useful Qmail Commands […]