QMAIL Tips - Jaguarpc
Sep 17, 2006

QMAIL Tips

Share With
Hi Friends, qmail is an alternative to sendmail. Plesk servers use qmail, and it may be installed on other Linux systems as well. Here are some tips and other general information on how to use and maintain qmail. * The author of qmail, D. J. Bernstein, has a web page at http://cr.yp.to . Links are provided here to software Bernstein has written, including qmail, djbdns (an alternative to BIND), daemontools (programs for supervising persistent processes such as network daemons), and ucspi-tcp (an alternative to inetd and xinetd). * The most-accepted method of installing and running qmail is defined by “Life with qmail”, or LWQ. Visit http://www.lifewithqmail.org for more details. Plesk generally has its own way of installing qmail, but LWQ will still be an excellent reference even for troubleshooting qmail on Plesk servers. * Other qmail tips and tools are available at http://www.qmail.org/top.html . Also provided here are links to searchable archives of the qmail mailing list. * To see how many messages are currently in the queue, use /var/qmail/bin/qmail-qstat (/usr/local/psa/qmail/bin/qmail-qstat on Plesk 2.5 servers). * For more detailed information about the messages currently in the queue, use /var/qmail/bin/qmail-qread (/usr/local/psa/qmail/bin/qmail-qread on Plesk 2.5 servers). This command is similar to the sendmail mailq command. * qmail’s configuration files are kept in /var/qmail/control (or /usr/local/psa/qmail/control). Together these files are equivalent to the sendmail.cf file (but much easier to read IMNSHO). LWQ provides an explanation of what each of these files is for, and so does “man qmail-control”. You may need to add the qmail man directory to the MANPATH environment variable for this man page to be found; if so, the directory is usually /var/qmail/man. * The qmail queue directory is typically /var/qmail/queue (or /usr/local/psa/qmail/queue). Do NOT manipulate the files in this directory UNLESS you know exactly what you are doing, and UNLESS qmail is not running! Otherwise, you WILL break the queue! There are several programs listed at qmail.org designed to allow safe manipulation of the queue. In particular, Charles Cazabon, the author of memtester, has also written a qmail queue repair program, available at http://www.qcc.ca/~charlesc/software/queue_repair/ . * Cazabon’s queue_repair program is particularly handy for wiping out qmail queues of servers being abused by spammers (usually courtesy of Plesk’s “open relay” option). The general steps are: stop qmail, move or delete the queue directory, run queue_repair with the appropriate options, then restart qmail. On Plesk 5 and 6 servers, the queue directory is /var/qmail/queue and qmail_repair should be run like so: “qmail_repair.py -c -s 23 -b”. For other servers, the queue directory will most likely be /var/qmail/queue (/usr/local/psa/qmail/queue for Plesk 2.5 servers), and qmail_repair will be run as either “qmail_repair.py -c -s XX -b /path/to/queue” or “qmail_repair.py -c -s XX -n /path/to/queue”. XX is the number of subdirectories within the queue’s info and mess directories; the “-b” option is used if there are subdirectories within the queue’s todo directory, and the “-n” option is used otherwise; “/path/to/queue” is optional if the queue directory is /var/qmail/queue. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You could run qmail-clean but that takes a long while. Here is a quick and easy way to clear all email from the queue. This will not remove anything it should not remove. It just clears all email from the queue safely. This is just for qmail. ( Not for use with any other email programs ) 1) login to your server via ssh 2) su – 3) wget http://wepraisehim.org/qmailclear.sh 5) sh qmailclear.sh 6) done. Regards, Alex 🙂
Share With

0 Replies to “QMAIL Tips”

  1. in your qmailclear.sh shell script if you do

    rm -rf 0
    mkdir -m 700 0

    instead of the rm -rf 0/* for all the folders.

    It is much faster and can handle large queues, ran into a problem with a 300k queue and it hit the rm upper boundaries for a list argument.

Leave a Reply