Bulk Deleting Outbound SMTP Queues in MS Exchange

A client is constantly getting hit with email attacks, and one such attack flooded the Exchange box with a couple hundred bogus NDRs which were trying to be delivered.

Removing these queues by hand is a royal pain, so I recalled a simple little kludge that would get all the bad mail into one queue so it could be deleted in one fell swoop instead of having to right click on every queue and choose “Delete all messages (No NDR)”

The steps are laid out pretty explicitly in a KB article from Microsoft, so I won’t go into great detail here. I’ll just give you the overview.

All of the following steps are done using the Exchange System Manager. I did this using Exchange 2000, it should work for Exchange 2003. I haven’t played with 2007 at all — three servers?!? — so I have no clue if this is still how it works.

First, you need to make sure all your good mail is out of the queue, so I tend to do this at 3 AM when I know that it’s been a few hours since anyone has tried to send any out-of-office mail and anything I’m going to find in the queue is crap. YMMV.

Next, stop the SMTP Virtual Server for the site.

Create a new SMTP Connector which is going to take all of the junk mail. Make sure the “Address Space” properties are set that SMTP is accepting for * (all domains) at a cost of 1.

Restart the SMTP Virtual Server.

All of the mail should now go into this new queue you created. Right click the queue, choose “Delete all messages (No NDR)”

Refresh the queue list a few times to make sure all messages are gone.

Stop the SMTP Virtual Server.

Delete the SMTP Connector you just made.

Restart the SMTP Virtual Server.

Mail should start flowing as usual.

One thought on “Bulk Deleting Outbound SMTP Queues in MS Exchange”

Comments are closed.