Today in a Plesk server, email was not working. Plesk uses qmail mail server. It is found 567154 emails in mail que.
[root@mail bin]# /var/qmail/bin/qmail-qstat messages in queue: 567154 messages in queue but not yet preprocessed: 3 [root@mail bin]#
So i installed qmHandle, but for some reason, it won’t work. It give some error when trying to delete the emails. May be due to large number of emails in Que.
So i installed Qmail-Remove available at
Installation was easy
[root@mail root]# tar -zxvf qmail-remove-0.94.tar.gz qmail-remove-0.94/ qmail-remove-0.94/Changelog qmail-remove-0.94/INSTALL qmail-remove-0.94/LICENSE qmail-remove-0.94/Makefile qmail-remove-0.94/README qmail-remove-0.94/TODO qmail-remove-0.94/populate.pl qmail-remove-0.94/qmail-remove.c [root@mail root]# cd qmail-remove-0.94 [root@mail qmail-remove-0.94]# make gcc -O2 -Wall -o qmail-remove qmail-remove.c [root@mail qmail-remove-0.94]# make install strip qmail-remove cp qmail-remove /usr/local/sbin [root@mail qmail-remove-0.94]# mkdir /var/qmail/queue/yanked [root@mail qmail-remove-0.94]#
After install, you can run Qmail Remove with command
[root@mail bin]# qmail-remove qmail-remove [options] -e use extended POSIX regular expressions -h, -? this help message -i search case insensitively [default: case sensitive] -n limit our search to the first bytes of each file -p specify the pattern to search for -q specify the base qmail queue dir [default: /var/qmail/queue] -r actually remove files, without this we'll only print them -s specify your conf-split value if non-standard [default: 23] -v increase verbosity (can be used more than once) -y directory to put files yanked from the queue [default: /yanked] -X modify timestamp on matching files, to make qmail expire mail is the number of seconds we want to move the file into the past. specifying a value of 0 causes this to default to (604800) -x modify timestamp on matching files, to make qmail expire mail is a date/time string in the format of output of the "date" program. see manpage for strptime(2) for details of this format [root@mail bin]#
To delete mails from Que,
qmail-remove -r -p STRING-HERE
STRING-HERE should be replaced with string that is in SPAM emails.
# qmail-remove -r -p dedicated.abac.net 324001: yes moved mess/0/324001 to yanked/324001.mess moved remote/0/324001 to yanked/324001.remote moved info/0/324001 to yanked/324001.info 324024: yes moved mess/0/324024 to yanked/324024.mess moved remote/0/324024 to yanked/324024.remote moved info/0/324024 to yanked/324024.info
This will remove all emails in que with “dedicated.abac.net” in it and place it in a folder.
/var/qmail/queue/yanked