Trying to send mail

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?
 
H

Herfried K. Wagner [MVP]

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"?
 
P

Phill. W

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.
 
G

Guest

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.
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top