Thursday, March 22, 2012

SmtpMail Problem

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,
ArthurHi 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 S Is What You Get.
"Arthur Carr" <youbet@.nowheretobefound.com> wrote in message
news:Hrc5e.5596$VF5.5211@.edtnps89...
> 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
>
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.
"Arthur Carré" wrote:

> Hi everyone. I have i big problem with the SmtpMail class of visual studi
o
> ..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, b
ut
> 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 ca
n
> 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
>
>

0 comments:

Post a Comment