I am sending a file as an attachment:
// Create the file attachment for this e-mail message.
Attachment data = new Attachment(filePa
You need to take advantage of "using" keyword:
using(Attachment att = new Attachment(...))
{
...
}
That's because "using" ensures IDisposable.Dispose method is called at the end of code block execution.
Whenever you use some class that's managing some resource, check if it's IDisposable and then use "using" block and you won't need to care about manually disposing calling IDisposable.Dispose.