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
2010-08-30 09:26:18
not infact smtpclient havnt any dispose functionand Stream is not used while sending the attachment, just using MailMessage and smtpclient
vakas
2010-08-30 09:32:52
@vakas: But both `MailMessage` and `AttachmentBase` do have `Dispose` methods, so it's still a valid suggestion.
ho1
2010-08-30 09:36:40
yes its working by disposing attachment object THNX....
vakas
2010-08-30 09:42:09
@vakas: So how do you add the attachment?
leppie
2010-08-30 09:42:26