tags:

views:

30

answers:

1

i am sending an attachement, and the email sends successfuly , but when i tries to delete the same file it gives the error as "file is being used by another process" i am deleting by system.io.file.delete()

+1  A: 

Did you Dispose correctly? For both the Stream and the SmtpClient after sending the mail?

leppie
not infact smtpclient havnt any dispose functionand Stream is not used while sending the attachment, just using MailMessage and smtpclient
vakas
@vakas: But both `MailMessage` and `AttachmentBase` do have `Dispose` methods, so it's still a valid suggestion.
ho1
yes its working by disposing attachment object THNX....
vakas
@vakas: So how do you add the attachment?
leppie