I recently did some work on an Ubuntu server with a compromised PHP site that was sending out massive amounts of spam email messages. After removing the offending scripts, I needed to clear out the mail queue to ensure that the server was not attempting to send backlogged spam messages.
The server in question is running Postfix as the MTA (Mail Transfer Agent) rather than Sendmail. Fortunately, clearing the entire queue was as easy as running the following:
[user@server ~]$ sudo postsuper -d ALL postsuper: Deleted: 69967 messages [user@server ~]$
If your server runs Sendmail, you will have to manually clear the mail queue by removing all the files at /var/spool/mqueue/
. For example:
[user@server ~]$ sudo rm -f /var/spool/mqueue/* [user@server ~]$
Did I help you?