DECLARE @email_min_date_to_keep datetime;
/* only delete email older than 7 days; change the -7 to whatever number of days you prefer before running */
SET @email_min_date_to_keep = DATEADD(DAY, -7, CAST(GETDATE() AS date))
EXEC msdb.dbo.sysmail_delete_mailitems_sp @sent_before = @email_min_date_to_keep
SQL DBA,SQL Server MVP(07, 08, 09) "Money can't buy you happiness." Maybe so, but it can make your unhappiness a LOT more comfortable!