Sunday, 23 September 2012

MS Exchange and it's BadMail folder

If you're using MS Exchange you may notice that the drive that exchange is stored on is slowly getting fuller and fuller. There's a good chance that the BadMail folder is filling up. This is normally in the exchange server folder under mailroot somewhere on your server.
Exchange SP1 is supposed to have disabled this but I have noticed in some installations that it is still enabled and being honest there is no reason for it.
So with a bit of registry tweaking you can either stop it filling up or limit it's size.
Run up regedit and go to the following
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SMTPSVC

Next, right click on the SMTPSVC and create a new key called Queuing as shown below.
In this key create a DWORD entry called MaxBadMailFolderSize and specify the maximum size of the Badmail folder in KB (as Decimal), then create another DWORD entry called BadMailSyncPeriod and specify, in minutes, how long the system should wait before checking the size of the Badmail folder (again, as Decimal).
In the image shown below the sync period is 15 mins and the size is 10Mb, set the size to zero and it stays empty which is now the default behaviour.



Don't try to open the folder in explorer as it's normally so full of stuff that it will take forever, it's best to right click on it and rename it to BadMailOld and create a new folder in it's place. You can then right click on the folder and select delete.

If you want to keep the BadMail folder going, there is some information from Microsoft, you can get it by clicking here.