SmtpMail Problem

A

Arthur Carré

Hi everyone. I have i big problem with the SmtpMail class of visual studio
..NET 2003.

Here it is :

I'm sending mail with attachment (1 or more) and if there is an exception
after contacting the SMTP server, i can catch this error in a try catch, but
the mail appear to stuck in the aspnet service (aspnet_wp.exe). What make
me tell that, is the attachment cannot be deleted because of acces
protection.
If a kill the service aspnet_wp.exe in the task manager, the attachment can
be deleted correctly.

So in short, if somebody try to send a mail and there is an exception, the
attachement that the person link with the email are UNDELETABLE until the
aspnet service is restarted...

Thanks in advance, plz answer in the newsgroup,

Arthur
 
K

Kevin Spencer

Hi Arthur,

This sort of exception is usually caused by a file being opened and not
closed properly. For example, in your code, you may have code that opens or
creates the attachment file, am I right? If an exception occurs, and there
is no try/catch, the code that closes the file will never be executed. You
would put the code that closes the file into the Finally block of a
try/catch block.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
G

Guest

Arthur, did you ever find a solution to this problem? I am seeing this same
behavior. It looks like SmtpMail isn't cleaning things up when it gets an
exeption.
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top