I made a form where the user can fill it out, browser for a file, and then click submit. I have it setup so the form data is emailed to me along with the attachment. It works except I can not delete the attachment from the server because it is still in use. Why is the file still in use after emailing it out? If I remove this line (upload the attachment but dont send it in the email) then the file is not in use and I can delete it after.) Why when I add the following line is the file in use after and can not be deleted??
message.Attachments.Add(new Attachment(strdir + strfilename));