By default, MSDB will store all those attachments you send, so you should clean them up or it will grow... well forever. So Microsoft provides a system stored procedure that allows you to purge ones older than a specified date. So for example if you wanted to purge everything older than 30 days, you could do something like this:
declare @purgeDate datetime
SET @purgeDate = dateadd(dd, -30, getdate())
EXECUTE msdb.dbo.sysmail_delete_mailitems_sp
@sent_before = @purgeDate;
No comments:
Post a Comment