Under most circumstances, the Mac OS X Server mail server automatically detects mail database issues and automatically runs a repair utility to correct them. In some situations, the issues are not detected and repair does not happen automatically.
To run repairDB:
1. Stop Mail Service using Server Admin (10.1) or Server Settings (10.2).
2. Open Terminal (/Applications/Utilities/).
3. At the prompt, type one of the following commands, as indicated for server versions 10.1 and 10.2.
For Mac OS X Server 10.1:
sudo /usr/sbin/MailService -repairDB
For Mac OS X Server 10.2:
sudo /usr/sbin/MailService -compressDB
4. Press Return.
5. Enter your Admin user password.
6. Press Return.
The repair utility runs. The status of the utility is reported in:
/Library/Logs/MailService/AppleMailServer.Repair.log
Upon completion of the database repair the following lines appears in AppleMailServer.Repair.log:
--- Finished mail database recovery --- Closing the new mail database
Now, you need to kill the MailService process and restart mail service:
1. At the prompt, type: top
2. Press Return.
3. In the resulting list, locate the process ID (PID) of the MailService process.
4. Press the "Q" to leave top and get a new prompt.
5. Type: kill <PID>
Note: Where the example says "<PID>", type only the actual number, for example, "kill 123".
6. Press Return.
7. Restart mail service