IIS/SMTP - unable to move emails from inetpub/mailroot/Queue due to file lock
- by Bryan Roth
I have a listener that processes emails in the inetpub/mailroot/Queue directory. Once the listener is done processing an email it proceeds to move the email to another directory. However, moving the email is not possible due to a file lock by the process inetinfo.exe. I have noticed that this file lock is released after a period time that ranges from several hours to several days. You can see that the Queue directory can get pretty full over time.
The only way I have been able to work around this is by manually stopping and starting my SMTP virtual server in IIS.
Is it possible to release this file lock programmatically? If not, is it possible to expedite releasing this file lock?