I'm running centos and have a rediculous amount of emails in the mailqueue due to a script error. Is there any way to remove messages that have a certain subject line in sendmail's mailqueue.
This worked for me just now, in testing (which is why it has such a weird subject line embedded in the code). It relies on the fact that the two files that make up a message in sendmail queue share the same filename except for the first character.
Once you're happy with the list of files it produces, change
In the sendmail
Inexplicably, it does not appear to be included with CentOS sendmail package, but you can extract it from the source distribution ( ftp://ftp.sendmail.org/pub/sendmail/sendmail-current.tar.gz ). It has minimal dependencies, they should all be part of a normal perl installation.
To delete messages use
To move them to an offline mqueue directory (safer):
Note it's "
You have the option of running that queue later with
(Older versions of qtool.pl are known to not parse the headers correctly, you need to omit the first letter on most headers, e.g.