The attached script can be used to maintain the size of the User Message tables if you do not wish to archive the mail tables using the mail archive scripts.
The script will not remove rows if they have not been processed by mail manager.
Before implementing the script please ensure a complete and working backup of your database has been taken.
Run the attached script against your ITBM database in SQL Query Analyzer. This will create a stored procedure named sp_MMClear. You will then need to schedule the stored procedure SP_MMClear to run once each day after the last backup of the day.
The Script has been updated to use set operations and to overcome some reported foreign key constraints issues reported with version 7.7+