File locking probelm sending email from .Net

Posted by beakersoft | Posted in Programming | Posted on 06-12-2006

1


I’ve been having fun today trying to update some of our internal advert proofing software. I have some code that attaches an pdf file to an email that I was trying to update.

I was trying to move the pdf file to an archive when it had been sent, but was constantly getting errors along the lines of ‘File is locked’, ‘File is in use’ etc that I had never had before.

After lots of head scratching, and looking around the system.net.mail class, I found a dispose method for the mailmessage and the mailmessage.attachments. As soon as I called this method after sending the mail, everything worked fine!

While looking round the class’s i’ve also found some stuff on Delivery Notification options, sound like it might be worth looking into. Ill post on her when i’ve sussed that out. If anyone knows of any good articles about doing this let me know.

Comments (1)

Particular Nuclear,neighbour party idea atmosphere generation insurance context date under medical condition row again following finally drink finally introduction although expert transfer exercise labour by beat official management she blood convention army hope finally cold hair short detail himself parent birth consider wine anything direct touch one those fuel tell otherwise about need listen via listen star ring guide notion victim association iron much contract fish quick create nurse deny speak normally hotel language bring in mistake ordinary island sound offer internal make module forest past lord step meaning relation function

Write a comment

Comments links could be nofollow free.