What happened to Badmails in Exchange 2003 SP1?


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.


Philip Chan


Comments (5)
  1. subsoniq says:

    now, can you come out with a hotfix to allow this on exchange 2000? :>

  2. Philip Chan says:

    The described behaviour is only available in Exchange 2003 Sp1. For other versions, the recommendation is to use the badmail script, which will allow similar behaviour. You can find the descritpon to the badmail script in Alvin Mok’s blog linked above.

  3. Brian says:

    Are the two registry keys DWORD type?

  4. Nino Bilic says:

    Brian – yes, they are both DWORDs.

  5. Chris says:

    I’ve never understood why you don’t just deliver the badmail to the postmaster as most other mail products do. That would make it a lot easier for those of us who do want to review them.

Comments are closed.

Skip to main content