# Database Discussions > Microsoft SQL Server 2005 >  Database mail issue

## mambo5cu

Recently I started using database mail.
I have noticed that when sending files attached to messages using sp_send_dbmail stored proc, after the message has been sent, there are still some folders remaining under the user's profile temporary folder (C:\Documents and Settings\user\Local Settings\Temp) which contain the files attached to the message. Even I can not delete these folders after the mail have been successfully sent.

Is this a "normal" behavior? or is there anyway of configuring dbmail to delete these "temporary" files after the mail have been successfully sent?

best regards,

Philip

----------


## rmiao

Do you have permission to delete files in other users' profile?

----------


## mambo5cu

Yes, in fact I'm logged using a user with local administration rights.
My main doubt is: Why these "temporary" folders (one per file being attached) don't get deleted after the mail have been successfully sent? Is it neccessary to delete them manually?

Even if I log off the user, when log in again files still remain there and it's impossible to delete them because they are in use....  :Frown: 

regards,
Philip

----------


## rmiao

Maybe user didn't read the mail yet. Did you get any error message when try to delete temp file?

----------


## mambo5cu

I can not delete the temp file immediately after the mail has been sent. I actually don't know if the SQL remains using it for some period of time or until the system or service restart.

The SQL server does not have to be aware of the fact of user reading its mail or not. In fact, the SQL server just queues the mail and pass it to the SMTP server, when the SMTP server suscessfully process the message no further information about the message delivery will be available to the SQL server.

Thank you,
Philip

----------

