Applies to: OS X Server 10.6 running junkmail and virus scanning.
Incoming and outgoing mail is not passing through the mail server and your mail queue (in Server Admin's Mail Maintenance tab) is growing and growing.
Looking at the mail.log, you see continuous "deferred" messages...
postfix/smtp: BAEDC948DF72: to=<firstname.lastname@example.org>, relay=127.0.0.1[127.0.0.1]:10024, delay=43, delays=0.47/0/43/0, dsn=4.4.2, status=deferred (lost connection with 127.0.0.1[127.0.0.1] while receiving the initial server greeting)
The System.log also shows a rather more worrying message...
org.amavis.amavisd: Suicide () TROUBLE in pre_loop_hook: db_init: BDB no dbS: __fop_file_setup: Retry limit (100) exceeded, File exists. at (eval 55) line 309.
And the amavisd.log repeats this error (without the melodramatic Suicide reference) and with a previous log line referencing the Berkeley database...
/usr/bin/amavisd: Creating db in /var/amavis/db/; BerkeleyDB 0.36, libdb 4.6
/usr/bin/amavisd: (!!)TROUBLE in pre_loop_hook: db_init: BDB no dbS: __fop_file_setup: Retry limit (100) exceeded, File exists. at (eval 55) line 309.
There are different variations to the error messages but they will typically refer to accessing the Berkely DB (BDB).
The clue to the solution is the reference to problems accessing the BerkelyDB at /var/amavis/db/
Simply stop the mail service (serveradmin stop mail), delete the existing contents of the db directory and restart mail service. Amavis will automatically recreate the database and hopefully everything will be back to normal.
Note that you are deleting the contents of the db directory, not the directory itself...
sudo rm /var/amavis/db/*
If the mail queue refuses to clear by itself (just click the Retry button in Server Admin -> Mail -> Maintenance -> Mail Queue) then resubmit all queued mail manually...
sudo postsuper -r ALL