What are badmails?
Badmails are mail that the Exchange server cannot deliver or NDR (non-delivery report). A common source of badmails comes from the unsuccessful attempt to deliver an DSN (delivery status notifiction. NDR is a form of DSN). We keep badmails around primarily for diagnostics.
Badmails accumulate in the Exchange badmail folder (by default Exchsrvr\Mailroot\vsi x\Badmail). Before Exchange 2003 SP1, badmails are written to the folder until the hard disk is full.
What has changed in Exchange 2003 SP1?
In Exchange 2003 SP1, out of the box, we do not write any badmails. Anything that is destined to badmail will disappear by default. Two regkeys are added to adjust the related behavior. They are briefly discussed as follows and there will eventually be a KB with more details on this.
Why did we make the change?
What we found out is that badmails are not commonly used. Many administrators simply delete the contents of the badmail folder periodically. Another reason is that if badmails are allowed to build up unchecked, the server runs out of disk space eventually.
If you do not care and do not want to see badmails, Exchange 2003 SP1 is perfect. Just install Exchange 2003 SP1, and badmails will no longer be an issue. If you want to keep some badmails around, read on…
About the regkeys:
You will need to add these under: HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\SMTPSVC\\Queuing
MaxBadMailFolderSize is the maximum number in kilobytes that the system will write badmail to each badmail folder. This setting applies to all badmail folders under the various VSI’s that you may have. Once a badmail folder hits the size, badmail will stop being written. Just to be perfectly clear, this is NOT a circular buffer. Once the badmail folder hits the limit, badmail writing will stop – your old badmails stay in the folder, and you will not get any new badmails. Using a value of -1 (0xffffffff hex in regedit) will give you the same functionality as in pre Exchange 2003 Sp1 Exchange, that is, badmails grow unbound. When the regkey is not set, it is 0: no badmail written.
BadMailSyncPeriod (in minutes) is how often Exchange looks in the system to see if badmails have been deleted. The server caches of the size of the badmail folder for performance reasons. This is used only when a MaxBadMailFolderSize is specified. The default, if regkey is not set, is 12 hours.
Together with the badmail script released in WR Feb 04, there is a lot of flexibility in dealing with badmails. Alvin Mok has written about the badmail script. You can, for example,
– Set MaxBadMailFolderSize to a number that you want to allocate for badmails.
– Use the badmail script to archive/delete badmails periodically as required.
Doing so will allow you to keep the badmails around for the period of time you desire. With the regkey, you can be sure that the server only writes up to a certain amount of badmails. Having the maximum protects your server when tons of un-expected badmails are generated.
Some more information on the subject can also be found in Evan Dodd’s blog on the subject here.