I am sending a file as an attachment:
// Create the file attachment for this e-mail message.
Attachment data = new Attachment(filePa
Here's another way to dispose of the Attachments, once you've finished with them...
// Prepare the MailMessage "mail" to get sent out...
await Task.Run(() => smtp.Send(mail));
// Then dispose of the Attachments.
foreach (Attachment attach in mail.Attachments)
{
// Very important, otherwise the files remain "locked", so can't be deleted
attach.Dispose();
}