Delete spam emails in Microsoft Exchange

Everything was running smoothly until one day I realized we were on an email blacklist.

Posted by Ryan Desmond on January 04, 2013

About a year ago we purchased a new server and setup Microsoft Exchange 2010 for the office. Everything was running smoothly until one day I realized we were on an email blacklist. After some investigating I found the mail server had an open relay and was trying to send a couple hundred thousand spam emails on the Exchange server.

I was looking for answers. I was trying to figure out how to get rid of all the spam, but, there were so many emails queued if you tried deleting the messages through the Exchange GUI the server would hang and become unresponsive. Obviously this method simply wouldn't and didn't work.

After several hours of head scratching I discovered a quick and easy way to delete all the spam emails from the Exchange server. Follow these steps:

  1. Stop the Exchange Transport service.
  2. Browse to the folder where mail.que is stored. For me it was located at c:\Program Files\Microsoft\Exchange Server\V14\TransportRoles\data\Queue.
  3. Delete or move contents of the queue folder. (Play it safe and move the contents and delete later.)
  4. Restart the Exchange Transport service.
  5. Open up Queue Viewer. Verify the spam emails are no longer in the queue.

By following the above steps I was able to remove all of the outbound spam emails from the Exchange server.

Now that the spam messages have been removed I closed the open email relay and removed ourselves from those pesky blacklists.

That certainly was not fun, but, like most things it was a good learning experience.