Jan 29, 2018 01:00 PM|PatriceSc|LINK
You are not solving the real issue but rather using a (ugly) mitigation
Try oMessage.Dispose() and get rid of Sleep to see what happens (or the message is sent async ???)
Whenever Dispose is available on an object you created it should be called (or usehttps://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/using-statement)
For now it seems definitely that once the mail is sent or built, you are not cleaning up correctly leaving attachment files open and making the deletion to fail.