IIS/SMTP - unable to move emails from inetpub/mailroot/Queue due to file lock
The "Queue" directory is meant for internal use by the SMTP server process. You're finding files locked there because you're not supposed to be working with them there. If your "Queue" directory is filling up then you'd be best-served to figure out why email deliveries are failing. It's unclear to me if the old SMTPDiag tool from Microsoft might work on Windows Server 2008, but it would be a place to start.
Update:
It's unclear to me exactly what you're trying to do with your processing task. The "Queue" folder is used to hold messages that are pending delivery. Messages that have are accepted for local delivery are stored in the "Drop" folder. Assuming you're looking for messages that are being accepted for local delivery I'd be concerned about why they're hanging out in "Queue" and not ending up in "Drop". There shouldn't be files building up in "Queue" unless something isn't working right.
(As an aside: Finding documentation re: the SMTP Service in Windows Server 2008 is turning out to be pretty difficult. The SMTP Service always has been a bit of an orphan, living in a netherworld between the Windows OS and Exchange. >sigh<)
Bryan Roth
Updated on September 18, 2022Comments
-
Bryan Roth over 1 year
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 processinetinfo.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 theQueue
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?
UPDATE
The listener monitors the
Queue
folder for incoming emails and then processes them. Data from the emails is then inserted into an internal program of ours. After the listener is done with the email it moves the email to a success or fail directory elsewhere.SOLVED
After coming back to this problem almost a year later I was finally able to solve it! The solution was to configure the SMTP Virtual Server's local (default) domain and set it to the appropriate domain of the emails I wanted to process. This caused emails to go into the
Drop
folder where they could be freely manipulated without having to worry about process locks. -
Bryan Roth almost 12 yearsIf I'm not supposed to work with files in the
Queue
directory, then which directory am I supposed to be using? -
Bryan Roth almost 12 yearsI'm not sure if restarting IIS via a scheduled task is a good idea. There has to be a better way. However, thanks for the tip on looking into the registry.
-
Spence almost 12 years@BryanRoth: I dropped on an edit, FWIW.
-
Bryan Roth almost 12 yearsThanks for the update. There isn't any local emails to be handled so the
Drop
folder is not used. I've updated my question to have more details to maybe help out in solving this problem.