i am using System.Net.Mail for sending mail in asp.net..
how to delete attachment file after it is send as attachment mail..
i tried to use File.Delete method.. but i am getting this error..
the process cannot access the file path\fun.jpg’ because it is being used by another process.
thank you
i am using System.Net.Mail for sending mail in asp.net.. how to delete attachment file
Share
Dispose of the MailMessage when you’re done with it.
It still has a lock on the file you’ve added as an attachment until you’ve done so.
Output: False
I would imagine that if you still have something locking the file after disposing the message, that you likely have another lock on the file, but without code, we can’t help you.