Trying to send mail

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am trying to send an email with attachments(these attachments are in
temporary folder) in ASP.NET using classes defined in System.Web.Mail
Namespace.

I dont have SMTP service installed on my machine.
When I invoke "Send" method of SMTPMail class it throws exception and in
"Finally" block I try deleting the temporary folder using
Directory.Delete(path,True).
The "Delete" command throws "System.IO.IOException: The directory is not
empty.".

Can someone please throw some light?
 
Sachin Gusain said:
"Finally" block I try deleting the temporary folder using
Directory.Delete(path,True).
The "Delete" command throws "System.IO.IOException: The directory is not
empty.".


What's "the temporary folder"?
 
Sachin Gusain said:
When I invoke "Send" method of SMTPMail class it throws exception

Maybe you should look to solving this one first ... ? But anyway ...
in "Finally" block I try deleting the temporary folder

Sending an attachment doesn't remove it from your machine!
Even after the Send, the attachments will /still/ be in the temporary
folder - you'll have to delete them yourself.

HTH,
Phill W.
 
Well, the temporary folder is being created in "c" drive of my machine.
In case "Send" method gives and exception, I am unable to delete the folder
with Directory.Delete method.
 
The temporary folder is being created in "C" drive of my machine.
When "Send" throws an exception, I try to delete the folder in "Finally"
block using "Directory.Delete which again throws the exception preventing me
from deleting the temporary folder.
 
Back
Top