Friday, February 24, 2012

Database mail attachments are filling the hard disk

My company started using database mail recently.Most emails sent have relatively large attachments. We've set up procedures for removing emails older than a given period of time from the MSDB database, however we've now had a server completely run out of the disk space due to attachments being stored in the C:\Documents and Settings\User\Local Settings\Temp folder!?! sysmail_delete_mailitems_sp sproc only removes entries in the MSDB tables, and doesn't remove these temporary files in the temp directory.

Somebody claims that those temp files are needed in case the file being attached is deleted before it has been sent for example. I'm agree with the procedure, but... Why SQL server does not delete the temporary file after a sucessfull delivery of the message?

It is not too hard to code some job to delete these files daily, but ... Is it too hard for Microsoft Team to develop this simple functionality?

Thanks,

Philip

I think that temp directory is associated to operating system for such actions its better to code a seperate steps to drop those temp files too. Also if you have any anti-virus or anti-spyware tool installed on the server then these will be in exclusive usage hence operating system may not delete them, hence the explicit deletion is required.

I feel this is a good feature to have, you could provide such feedback on http://connect.microsoft.com site in thsi case to involve on next Service pack or in SQL 2008 release.

No comments:

Post a Comment