You can t delete a attached file after sending the mail.Before sending you can delete.
What the error says that, the path you have mentioned is using some other process.
MailMessage Message = new MailMessage();
Message.Subject = "Attachment Test";
Message.Body = "Check out the attachment!";
Message.To.Add("webmaster@15Seconds.com");
Message.From = "someone@somedomain.com";
Message.Attachments.Add(new Attachment(memorystream, "test.txt", MediaTypeNames.Application.Text));
Notice that we created the attachment from the MemoryStream and we got to name the attachment anything we want. The name of the attachment in the second parameter is the name of the file in the email, not the name on the local system hard drive. In fact the attachment never goes to the local hard drive. The third parameter is the Mime type of the attachment, in our case this is text.
Edit: use Dispose() the mail