smtpClient.Send(message)
is causing me problems as per specifics in the trace below. Email is sent
but not without this error typically upon sending the second email, but
sometimes when running the app, even the first time. The application will
be required to be sending out repeated emails, about one every second or
two.
Must this be done asynchronously? Thank you. -Greg
I get the generic error messages;
Troubleshooting Exceptions: System.ObjectDisposedException 'Safe handle
has been closed'
An ObjectDisposedException exception is thrown when an operation is
attempted on a disposed object, such as a closed stream or registry key.
Make sure you have not released a resource before attempting to use it.
For example, if attempting to manipulate a stream, make sure it has not
been previously closed.
System.Net.Sockets Verbose: 0 : [2568] Exiting Socket#43667493::Send() ->
1024#1024
System.Net.Sockets Verbose: 0 : [2568] Socket#43667493::Send()
System.Net.Sockets Verbose: 0 : [2568] Data from Socket#43667493::Send
System.Net.Sockets Verbose: 0 : [2568] 00000000 : 52 65 63 4E 61 6D 65
7D-3C 42 52 3E 3D 30 44 3D : RecName}<BR>=0D=
System.Net.Sockets Verbose: 0 : [2568] 00000010 : 30 41 54 6F 74 61 6C
4D-6F 76 65 2E 63 6F 6D 3C : 0Axxxx.com<
System.Net.Sockets Verbose: 0 : [2568] 00000020 : 42 52 3E 3D 30 44 3D
30-41 28 38 37 37 29 20 39 : BR>=0D=0A(877) 9
System.Net.Sockets Verbose: 0 : [2568] 00000030 : 36 38 2D 4D 4F 56 45
20-28 36 36 38 33 29 3C 42 : 68-MOVE (6683)<B
System.Net.Sockets Verbose: 0 : [2568] 00000040 : 52 3E 3D 0D 0A 3D 30
44-3D 30 41 7B 52 65 63 45 : R>=..=0D=0A{RecE
System.Net.Sockets Verbose: 0 : [2568] 00000050 : 6D 61 69 6C 7D 3C 42
52-3E 3D 30 44 3D 30 41 3C : mail}<BR>=0D=0A<
System.Net.Sockets Verbose: 0 : [2568] 00000060 : 2F 66 6F 6E 74 3E 3C
2F-74 64 3E 3C 2F 74 72 3E : /font></td></tr>
System.Net.Sockets Verbose: 0 : [2568] 00000070 : 3C 2F 74 61 62 6C 65
3E-3C 2F 62 6F 64 79 3E 3C : </table></body><
System.Net.Sockets Verbose: 0 : [2568] 00000080 : 2F 68 74 6D 6C 3E :
/html>
System.Net.Sockets Verbose: 0 : [2568] Exiting Socket#43667493::Send() ->
134#134
System.Net.Sockets Verbose: 0 : [2568] Socket#43667493::Send()
System.Net.Sockets Verbose: 0 : [2568] Data from Socket#43667493::Send
System.Net.Sockets Verbose: 0 : [2568] 00000000 : 0D 0A : ..
System.Net.Sockets Verbose: 0 : [2568] Exiting Socket#43667493::Send() ->
2#2
System.Net.Sockets Verbose: 0 : [2568] Socket#43667493::Send()
System.Net.Sockets Verbose: 0 : [2568] Data from Socket#43667493::Send
System.Net.Sockets Verbose: 0 : [2568] 00000000 : 0D 0A 2E 0D 0A : .....
System.Net.Sockets Verbose: 0 : [2568] Exiting Socket#43667493::Send() ->
5#5
System.Net.Sockets Verbose: 0 : [2568] Socket#43667493::Receive()
System.Net.Sockets Verbose: 0 : [2568] Data from Socket#43667493::Receive
System.Net.Sockets Verbose: 0 : [2568] 00000000 : 32 35 30 20 4D 61 69
6C-20 71 75 65 75 65 64 20 : 250 Mail queued
System.Net.Sockets Verbose: 0 : [2568] 00000010 : 66 6F 72 20 64 65 6C
69-76 65 72 79 2E 0D 0A : for delivery...
System.Net.Sockets Verbose: 0 : [2568] Exiting
Socket#43667493::Receive() -> 31#31
System.Net Verbose: 0 : [2568] Exiting SmtpClient#25675301::Send()
System.Net.Sockets Verbose: 0 : [5560] Socket#57792633::Dispose()
System.Net.Sockets Verbose: 0 : [5560] Socket#57792633::Shutdown(Both#2)
System.Transactions Critical: 0 : <TraceRecord
xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord"
Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled
exception</Description><AppDomain>LeadProcessingServiceConsol e.vshost.exe</AppDomain><Exception><ExceptionType>System.ObjectD isposedException,
mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Safe handle has been
closed</Message><StackTrace> at
System.Net.UnsafeNclNativeMethods.OSSOCK.shutdown( SafeCloseSocket
socketHandle, Int32 how)
at System.Net.Sockets.Socket.Shutdown(SocketShutdown how)
at
?.Finalize()</StackTrace><ExceptionString>System.ObjectDisposedE xception:
Safe handle has been closed
at System.Net.UnsafeNclNativeMethods.OSSOCK.shutdown( SafeCloseSocket
socketHandle, Int32 how)
at System.Net.Sockets.Socket.Shutdown(SocketShutdown how)
at ?.Finalize()</ExceptionString></Exception></TraceRecord>
System.Net Error: 0 : [5560] Exception in the
#62476613::UnhandledExceptionHandler - Safe handle has been closed
System.Net Error: 0 : [5560] at
System.Net.UnsafeNclNativeMethods.OSSOCK.shutdown( SafeCloseSocket
socketHandle, Int32 how)
at System.Net.Sockets.Socket.Shutdown(SocketShutdown how)
at ?.Finalize() 11 7654
> smtpClient.Send(message) I get the generic error messages; Troubleshooting Exceptions: System.ObjectDisposedException 'Safe handle has been closed' Must this be done asynchronously? Thank you. -Greg
Apparently the SmtpClient is finalizing the underlying socket twice; it
might mean that you are using the SmtpClient when it is not in a
suitable state, though it's difficult to see why without knowing what
your code looks like. There should be no need to do it asynchronously,
though it is neater; in this context, one would expect sending
synchronously to be more reliable as you can be sure that the
SmtpClient has finished sending the previous message; if you 'doubled
up' sending because it was asynchronous, that would cause an exception.
It'd be helpful if you could post some code, though.
No, it's not necessary to use threading, but without knowing how you *are*
doing this, I can't tell you more than that.
--
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Hard work is a medication for which
there is no placebo.
"hazz" <ha**@sonic.net> wrote in message
news:uT**************@TK2MSFTNGP02.phx.gbl... smtpClient.Send(message)
is causing me problems as per specifics in the trace below. Email is sent but not without this error typically upon sending the second email, but sometimes when running the app, even the first time. The application will be required to be sending out repeated emails, about one every second or two. Must this be done asynchronously? Thank you. -Greg
I get the generic error messages; Troubleshooting Exceptions: System.ObjectDisposedException 'Safe handle has been closed'
An ObjectDisposedException exception is thrown when an operation is attempted on a disposed object, such as a closed stream or registry key.
Make sure you have not released a resource before attempting to use it. For example, if attempting to manipulate a stream, make sure it has not been previously closed.
System.Net.Sockets Verbose: 0 : [2568] Exiting Socket#43667493::Send() -> 1024#1024 System.Net.Sockets Verbose: 0 : [2568] Socket#43667493::Send() System.Net.Sockets Verbose: 0 : [2568] Data from Socket#43667493::Send System.Net.Sockets Verbose: 0 : [2568] 00000000 : 52 65 63 4E 61 6D 65 7D-3C 42 52 3E 3D 30 44 3D : RecName}<BR>=0D= System.Net.Sockets Verbose: 0 : [2568] 00000010 : 30 41 54 6F 74 61 6C 4D-6F 76 65 2E 63 6F 6D 3C : 0Axxxx.com< System.Net.Sockets Verbose: 0 : [2568] 00000020 : 42 52 3E 3D 30 44 3D 30-41 28 38 37 37 29 20 39 : BR>=0D=0A(877) 9 System.Net.Sockets Verbose: 0 : [2568] 00000030 : 36 38 2D 4D 4F 56 45 20-28 36 36 38 33 29 3C 42 : 68-MOVE (6683)<B System.Net.Sockets Verbose: 0 : [2568] 00000040 : 52 3E 3D 0D 0A 3D 30 44-3D 30 41 7B 52 65 63 45 : R>=..=0D=0A{RecE System.Net.Sockets Verbose: 0 : [2568] 00000050 : 6D 61 69 6C 7D 3C 42 52-3E 3D 30 44 3D 30 41 3C : mail}<BR>=0D=0A< System.Net.Sockets Verbose: 0 : [2568] 00000060 : 2F 66 6F 6E 74 3E 3C 2F-74 64 3E 3C 2F 74 72 3E : /font></td></tr> System.Net.Sockets Verbose: 0 : [2568] 00000070 : 3C 2F 74 61 62 6C 65 3E-3C 2F 62 6F 64 79 3E 3C : </table></body>< System.Net.Sockets Verbose: 0 : [2568] 00000080 : 2F 68 74 6D 6C 3E : /html> System.Net.Sockets Verbose: 0 : [2568] Exiting Socket#43667493::Send() -> 134#134 System.Net.Sockets Verbose: 0 : [2568] Socket#43667493::Send() System.Net.Sockets Verbose: 0 : [2568] Data from Socket#43667493::Send System.Net.Sockets Verbose: 0 : [2568] 00000000 : 0D 0A : .. System.Net.Sockets Verbose: 0 : [2568] Exiting Socket#43667493::Send() -> 2#2 System.Net.Sockets Verbose: 0 : [2568] Socket#43667493::Send() System.Net.Sockets Verbose: 0 : [2568] Data from Socket#43667493::Send System.Net.Sockets Verbose: 0 : [2568] 00000000 : 0D 0A 2E 0D 0A : ..... System.Net.Sockets Verbose: 0 : [2568] Exiting Socket#43667493::Send() -> 5#5 System.Net.Sockets Verbose: 0 : [2568] Socket#43667493::Receive() System.Net.Sockets Verbose: 0 : [2568] Data from Socket#43667493::Receive System.Net.Sockets Verbose: 0 : [2568] 00000000 : 32 35 30 20 4D 61 69 6C-20 71 75 65 75 65 64 20 : 250 Mail queued System.Net.Sockets Verbose: 0 : [2568] 00000010 : 66 6F 72 20 64 65 6C 69-76 65 72 79 2E 0D 0A : for delivery... System.Net.Sockets Verbose: 0 : [2568] Exiting Socket#43667493::Receive() -> 31#31 System.Net Verbose: 0 : [2568] Exiting SmtpClient#25675301::Send() System.Net.Sockets Verbose: 0 : [5560] Socket#57792633::Dispose() System.Net.Sockets Verbose: 0 : [5560] Socket#57792633::Shutdown(Both#2) System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>LeadProcessingServiceConsol e.vshost.exe</AppDomain><Exception><ExceptionType>System.ObjectD isposedException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Safe handle has been closed</Message><StackTrace> at System.Net.UnsafeNclNativeMethods.OSSOCK.shutdown( SafeCloseSocket socketHandle, Int32 how) at System.Net.Sockets.Socket.Shutdown(SocketShutdown how) at ?.Finalize()</StackTrace><ExceptionString>System.ObjectDisposedE xception: Safe handle has been closed at System.Net.UnsafeNclNativeMethods.OSSOCK.shutdown( SafeCloseSocket socketHandle, Int32 how) at System.Net.Sockets.Socket.Shutdown(SocketShutdown how) at ?.Finalize()</ExceptionString></Exception></TraceRecord> System.Net Error: 0 : [5560] Exception in the #62476613::UnhandledExceptionHandler - Safe handle has been closed System.Net Error: 0 : [5560] at System.Net.UnsafeNclNativeMethods.OSSOCK.shutdown( SafeCloseSocket socketHandle, Int32 how) at System.Net.Sockets.Socket.Shutdown(SocketShutdown how) at ?.Finalize()
Oh, sorrry Paul. And doubly sorry this is vb.net. I am doing both C# and
vb.net projects. Hopefully the smtpClient code logic flow will be enough to
help out here.
Function Send1(ByVal strFrom As String, ByVal strTo As String, ByVal
strSubject As String, ByVal strBody As String, Optional ByVal Format As
String = "") As Boolean
Try
Using message As New MailMessage(strFrom , strTo , strSubject , strBody)
Dim smtpClientAs SmtpClient = New SmtpClient()
Dim fromAddress As MailAddress = New MailAddress(fromAddress1,
"Sender Name")
smtpClient.Host =
System.Configuration.ConfigurationManager.AppSetti ngs("MxServer")
smtpClient.Port = 25
smtpClient.Send(message)
End Using
End Try
"Paul Henderson" <pa***********@pittville.demon.co.uk> wrote in message
news:11*********************@e56g2000cwe.googlegro ups.com... smtpClient.Send(message)
I get the generic error messages; Troubleshooting Exceptions: System.ObjectDisposedException 'Safe handle has been closed' Must this be done asynchronously? Thank you. -Greg
Apparently the SmtpClient is finalizing the underlying socket twice; it might mean that you are using the SmtpClient when it is not in a suitable state, though it's difficult to see why without knowing what your code looks like. There should be no need to do it asynchronously, though it is neater; in this context, one would expect sending synchronously to be more reliable as you can be sure that the SmtpClient has finished sending the previous message; if you 'doubled up' sending because it was asynchronous, that would cause an exception. It'd be helpful if you could post some code, though.
I can only guess here. A lot of the SmtpClient class is a black box, but
I've used it successfully for a long time without this issue. The first
question that pops into my mind is whether or not the SMTP server requires
authentication. I see you're not passing any credentials, and have not
specified UseDefaultCredentials. Most SMTP servers do require authentication
of some sort. I'm not sure what this might have to do with the exception,
other than the possibility that another exception may be triggering it. Does
the exception contain an InnerException? Are you catching all exceptions?
--
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Hard work is a medication for which
there is no placebo.
"hazz" <ha**@sonic.net> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl... Oh, sorrry Paul. And doubly sorry this is vb.net. I am doing both C# and vb.net projects. Hopefully the smtpClient code logic flow will be enough to help out here.
Function Send1(ByVal strFrom As String, ByVal strTo As String, ByVal strSubject As String, ByVal strBody As String, Optional ByVal Format As String = "") As Boolean Try Using message As New MailMessage(strFrom , strTo , strSubject , strBody) Dim smtpClientAs SmtpClient = New SmtpClient() Dim fromAddress As MailAddress = New MailAddress(fromAddress1, "Sender Name") smtpClient.Host = System.Configuration.ConfigurationManager.AppSetti ngs("MxServer") smtpClient.Port = 25 smtpClient.Send(message) End Using End Try
"Paul Henderson" <pa***********@pittville.demon.co.uk> wrote in message news:11*********************@e56g2000cwe.googlegro ups.com... smtpClient.Send(message)
I get the generic error messages; Troubleshooting Exceptions: System.ObjectDisposedException 'Safe handle has been closed' Must this be done asynchronously? Thank you. -Greg
Apparently the SmtpClient is finalizing the underlying socket twice; it might mean that you are using the SmtpClient when it is not in a suitable state, though it's difficult to see why without knowing what your code looks like. There should be no need to do it asynchronously, though it is neater; in this context, one would expect sending synchronously to be more reliable as you can be sure that the SmtpClient has finished sending the previous message; if you 'doubled up' sending because it was asynchronous, that would cause an exception. It'd be helpful if you could post some code, though.
Thank you for your questions Kevin. It sends email but the exception is
intermittent (the worse kind) so it isn't credentials.
The innerexception is null. It is sort of a black box. Is it a COM wrapper
or is it an all .net from the ground up system? I have been told to try http://www.devmail.net/ by a colleague and see if that works.
Thanks again. -Greg
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:eC**************@TK2MSFTNGP05.phx.gbl... I can only guess here. A lot of the SmtpClient class is a black box, but I've used it successfully for a long time without this issue. The first question that pops into my mind is whether or not the SMTP server requires authentication. I see you're not passing any credentials, and have not specified UseDefaultCredentials. Most SMTP servers do require authentication of some sort. I'm not sure what this might have to do with the exception, other than the possibility that another exception may be triggering it. Does the exception contain an InnerException? Are you catching all exceptions?
-- HTH,
Kevin Spencer Microsoft MVP Professional Numbskull
Hard work is a medication for which there is no placebo.
"hazz" <ha**@sonic.net> wrote in message news:%2****************@TK2MSFTNGP02.phx.gbl... Oh, sorrry Paul. And doubly sorry this is vb.net. I am doing both C# and vb.net projects. Hopefully the smtpClient code logic flow will be enough to help out here.
Function Send1(ByVal strFrom As String, ByVal strTo As String, ByVal strSubject As String, ByVal strBody As String, Optional ByVal Format As String = "") As Boolean Try Using message As New MailMessage(strFrom , strTo , strSubject , strBody) Dim smtpClientAs SmtpClient = New SmtpClient() Dim fromAddress As MailAddress = New MailAddress(fromAddress1, "Sender Name") smtpClient.Host = System.Configuration.ConfigurationManager.AppSetti ngs("MxServer") smtpClient.Port = 25 smtpClient.Send(message) End Using End Try
"Paul Henderson" <pa***********@pittville.demon.co.uk> wrote in message news:11*********************@e56g2000cwe.googlegro ups.com... smtpClient.Send(message)
I get the generic error messages; Troubleshooting Exceptions: System.ObjectDisposedException 'Safe handle has been closed' Must this be done asynchronously? Thank you. -Greg
Apparently the SmtpClient is finalizing the underlying socket twice; it might mean that you are using the SmtpClient when it is not in a suitable state, though it's difficult to see why without knowing what your code looks like. There should be no need to do it asynchronously, though it is neater; in this context, one would expect sending synchronously to be more reliable as you can be sure that the SmtpClient has finished sending the previous message; if you 'doubled up' sending because it was asynchronous, that would cause an exception. It'd be helpful if you could post some code, though.
The problem was chunking. http://www.devmail.net/ 's product has a property
setting to set chunking to false. The smtp class in .net does not have that
capability. -greg hazzard
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:eC**************@TK2MSFTNGP05.phx.gbl... I can only guess here. A lot of the SmtpClient class is a black box, but I've used it successfully for a long time without this issue. The first question that pops into my mind is whether or not the SMTP server requires authentication. I see you're not passing any credentials, and have not specified UseDefaultCredentials. Most SMTP servers do require authentication of some sort. I'm not sure what this might have to do with the exception, other than the possibility that another exception may be triggering it. Does the exception contain an InnerException? Are you catching all exceptions?
-- HTH,
Kevin Spencer Microsoft MVP Professional Numbskull
Hard work is a medication for which there is no placebo.
"hazz" <ha**@sonic.net> wrote in message news:%2****************@TK2MSFTNGP02.phx.gbl... Oh, sorrry Paul. And doubly sorry this is vb.net. I am doing both C# and vb.net projects. Hopefully the smtpClient code logic flow will be enough to help out here.
Function Send1(ByVal strFrom As String, ByVal strTo As String, ByVal strSubject As String, ByVal strBody As String, Optional ByVal Format As String = "") As Boolean Try Using message As New MailMessage(strFrom , strTo , strSubject , strBody) Dim smtpClientAs SmtpClient = New SmtpClient() Dim fromAddress As MailAddress = New MailAddress(fromAddress1, "Sender Name") smtpClient.Host = System.Configuration.ConfigurationManager.AppSetti ngs("MxServer") smtpClient.Port = 25 smtpClient.Send(message) End Using End Try
"Paul Henderson" <pa***********@pittville.demon.co.uk> wrote in message news:11*********************@e56g2000cwe.googlegro ups.com... smtpClient.Send(message)
I get the generic error messages; Troubleshooting Exceptions: System.ObjectDisposedException 'Safe handle has been closed' Must this be done asynchronously? Thank you. -Greg
Apparently the SmtpClient is finalizing the underlying socket twice; it might mean that you are using the SmtpClient when it is not in a suitable state, though it's difficult to see why without knowing what your code looks like. There should be no need to do it asynchronously, though it is neater; in this context, one would expect sending synchronously to be more reliable as you can be sure that the SmtpClient has finished sending the previous message; if you 'doubled up' sending because it was asynchronous, that would cause an exception. It'd be helpful if you could post some code, though.
The problem was chunking. http://www.devmail.net/ 's product has a property
setting to set chunking to false. The smtp class in .net does not have that
capability. -greg
"Paul Henderson" <pa***********@pittville.demon.co.uk> wrote in message
news:11*********************@e56g2000cwe.googlegro ups.com... smtpClient.Send(message)
I get the generic error messages; Troubleshooting Exceptions: System.ObjectDisposedException 'Safe handle has been closed' Must this be done asynchronously? Thank you. -Greg
Apparently the SmtpClient is finalizing the underlying socket twice; it might mean that you are using the SmtpClient when it is not in a suitable state, though it's difficult to see why without knowing what your code looks like. There should be no need to do it asynchronously, though it is neater; in this context, one would expect sending synchronously to be more reliable as you can be sure that the SmtpClient has finished sending the previous message; if you 'doubled up' sending because it was asynchronous, that would cause an exception. It'd be helpful if you could post some code, though.
Hi Greg,
Glad you got it sorted out. But I'm curious now as to how you came to that
conclusion, and where you got that information from? I haven't seen it in
any of the SDK documentation. In fact, there is precious little mention at
all of whether the SmtpClient class uses SMTP or ESMTP. To employ chunking,
it would have to be using ESMTP.
--
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Hard work is a medication for which
there is no placebo.
"hazz" <ha**@sonic.net> wrote in message
news:Op**************@TK2MSFTNGP05.phx.gbl... The problem was chunking. http://www.devmail.net/ 's product has a property setting to set chunking to false. The smtp class in .net does not have that capability. -greg
"Paul Henderson" <pa***********@pittville.demon.co.uk> wrote in message news:11*********************@e56g2000cwe.googlegro ups.com... smtpClient.Send(message)
I get the generic error messages; Troubleshooting Exceptions: System.ObjectDisposedException 'Safe handle has been closed' Must this be done asynchronously? Thank you. -Greg
Apparently the SmtpClient is finalizing the underlying socket twice; it might mean that you are using the SmtpClient when it is not in a suitable state, though it's difficult to see why without knowing what your code looks like. There should be no need to do it asynchronously, though it is neater; in this context, one would expect sending synchronously to be more reliable as you can be sure that the SmtpClient has finished sending the previous message; if you 'doubled up' sending because it was asynchronous, that would cause an exception. It'd be helpful if you could post some code, though.
Kevin,
Please excuse my really paint by number approach here. I still really don't
understand the underpinnings.
When I tried the 3rd party email utility out, I came up with an error that
was solved in a support group. It reminded me of some trace log data that I
noticed during the course of troubleshooting. Here is the support answer
which is specific to that product; all I can say is that after I added the
line of code they suggested,
(msg.SMTPServer.UseChunking = false; ) I was sending email without the
persistent random exceptions.
It seems you are using Microsoft SMTP Service which has a bug with
"chunking" (BDAT command) implementation.
Basically, devMail.Net tries to take advantage of the chunking feature
whenever it is available on the mail server to improve performance.
Microsoft SMTP Service claims that it supports chunking but it
sometimes fails when a BDAT command is sent.
To fix this, please add the following line before calling msg.Send()
msg.SMTPServer.UseChunking = false;
And your problem will be gone. http://dev.devbiz.com/forums/721/ShowPost.aspx
My question would be at this point, where does this chunking take place, on
some remote server....and what is it? What does chunking accomplish?
Thanks for your help, support and questions.
-Greg
************************************************** **********
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:eV**************@TK2MSFTNGP02.phx.gbl... Hi Greg,
Glad you got it sorted out. But I'm curious now as to how you came to that conclusion, and where you got that information from? I haven't seen it in any of the SDK documentation. In fact, there is precious little mention at all of whether the SmtpClient class uses SMTP or ESMTP. To employ chunking, it would have to be using ESMTP.
-- HTH,
Kevin Spencer Microsoft MVP Professional Numbskull
Hard work is a medication for which there is no placebo.
"hazz" <ha**@sonic.net> wrote in message news:Op**************@TK2MSFTNGP05.phx.gbl... The problem was chunking. http://www.devmail.net/ 's product has a property setting to set chunking to false. The smtp class in .net does not have that capability. -greg
"Paul Henderson" <pa***********@pittville.demon.co.uk> wrote in message news:11*********************@e56g2000cwe.googlegro ups.com... smtpClient.Send(message)
I get the generic error messages; Troubleshooting Exceptions: System.ObjectDisposedException 'Safe handle has been closed' Must this be done asynchronously? Thank you. -Greg
Apparently the SmtpClient is finalizing the underlying socket twice; it might mean that you are using the SmtpClient when it is not in a suitable state, though it's difficult to see why without knowing what your code looks like. There should be no need to do it asynchronously, though it is neater; in this context, one would expect sending synchronously to be more reliable as you can be sure that the SmtpClient has finished sending the previous message; if you 'doubled up' sending because it was asynchronous, that would cause an exception. It'd be helpful if you could post some code, though.
The System.Net.SmtpClient class is an SMTP client, and does not employ any
internal SMTP server. The devMail.Net component which you apparently bought
does. So, that really has nothing to do with the problem you were
experiencing with the System.Net.SmtpClient. At any rate, glad you got
something working!
--
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Hard work is a medication for which
there is no placebo.
"hazz" <ha**@sonic.net> wrote in message
news:eg**************@TK2MSFTNGP03.phx.gbl... Kevin, Please excuse my really paint by number approach here. I still really don't understand the underpinnings.
When I tried the 3rd party email utility out, I came up with an error that was solved in a support group. It reminded me of some trace log data that I noticed during the course of troubleshooting. Here is the support answer which is specific to that product; all I can say is that after I added the line of code they suggested, (msg.SMTPServer.UseChunking = false; ) I was sending email without the persistent random exceptions.
It seems you are using Microsoft SMTP Service which has a bug with "chunking" (BDAT command) implementation.
Basically, devMail.Net tries to take advantage of the chunking feature whenever it is available on the mail server to improve performance. Microsoft SMTP Service claims that it supports chunking but it sometimes fails when a BDAT command is sent.
To fix this, please add the following line before calling msg.Send()
msg.SMTPServer.UseChunking = false;
And your problem will be gone.
http://dev.devbiz.com/forums/721/ShowPost.aspx
My question would be at this point, where does this chunking take place, on some remote server....and what is it? What does chunking accomplish?
Thanks for your help, support and questions. -Greg ************************************************** **********
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message news:eV**************@TK2MSFTNGP02.phx.gbl... Hi Greg,
Glad you got it sorted out. But I'm curious now as to how you came to that conclusion, and where you got that information from? I haven't seen it in any of the SDK documentation. In fact, there is precious little mention at all of whether the SmtpClient class uses SMTP or ESMTP. To employ chunking, it would have to be using ESMTP.
-- HTH,
Kevin Spencer Microsoft MVP Professional Numbskull
Hard work is a medication for which there is no placebo.
"hazz" <ha**@sonic.net> wrote in message news:Op**************@TK2MSFTNGP05.phx.gbl... The problem was chunking. http://www.devmail.net/ 's product has a property setting to set chunking to false. The smtp class in .net does not have that capability. -greg
"Paul Henderson" <pa***********@pittville.demon.co.uk> wrote in message news:11*********************@e56g2000cwe.googlegro ups.com... > smtpClient.Send(message)
> I get the generic error messages; > Troubleshooting Exceptions: System.ObjectDisposedException 'Safe > handle > has been closed' > Must this be done asynchronously? Thank you. -Greg
Apparently the SmtpClient is finalizing the underlying socket twice; it might mean that you are using the SmtpClient when it is not in a suitable state, though it's difficult to see why without knowing what your code looks like. There should be no need to do it asynchronously, though it is neater; in this context, one would expect sending synchronously to be more reliable as you can be sure that the SmtpClient has finished sending the previous message; if you 'doubled up' sending because it was asynchronous, that would cause an exception. It'd be helpful if you could post some code, though.
Yes, I just discovered there is yet another layer to the issue. Yes I did
get it working and yes, it appears the chunking had nothing to do with the
problem. My solution in VS2003 app is running and a VS2005 solution with the
same code does not.
Thanks Kevin for not allowing me to follow along with that illusion.
The discovery process continues.
Greg
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:e$**************@TK2MSFTNGP05.phx.gbl... The System.Net.SmtpClient class is an SMTP client, and does not employ any internal SMTP server. The devMail.Net component which you apparently bought does. So, that really has nothing to do with the problem you were experiencing with the System.Net.SmtpClient. At any rate, glad you got something working!
-- HTH,
Kevin Spencer Microsoft MVP Professional Numbskull
Hard work is a medication for which there is no placebo.
"hazz" <ha**@sonic.net> wrote in message news:eg**************@TK2MSFTNGP03.phx.gbl... Kevin, Please excuse my really paint by number approach here. I still really don't understand the underpinnings.
When I tried the 3rd party email utility out, I came up with an error that was solved in a support group. It reminded me of some trace log data that I noticed during the course of troubleshooting. Here is the support answer which is specific to that product; all I can say is that after I added the line of code they suggested, (msg.SMTPServer.UseChunking = false; ) I was sending email without the persistent random exceptions.
It seems you are using Microsoft SMTP Service which has a bug with "chunking" (BDAT command) implementation.
Basically, devMail.Net tries to take advantage of the chunking feature whenever it is available on the mail server to improve performance. Microsoft SMTP Service claims that it supports chunking but it sometimes fails when a BDAT command is sent.
To fix this, please add the following line before calling msg.Send()
msg.SMTPServer.UseChunking = false;
And your problem will be gone.
http://dev.devbiz.com/forums/721/ShowPost.aspx
My question would be at this point, where does this chunking take place, on some remote server....and what is it? What does chunking accomplish?
Thanks for your help, support and questions. -Greg ************************************************** **********
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message news:eV**************@TK2MSFTNGP02.phx.gbl... Hi Greg,
Glad you got it sorted out. But I'm curious now as to how you came to that conclusion, and where you got that information from? I haven't seen it in any of the SDK documentation. In fact, there is precious little mention at all of whether the SmtpClient class uses SMTP or ESMTP. To employ chunking, it would have to be using ESMTP.
-- HTH,
Kevin Spencer Microsoft MVP Professional Numbskull
Hard work is a medication for which there is no placebo.
"hazz" <ha**@sonic.net> wrote in message news:Op**************@TK2MSFTNGP05.phx.gbl... The problem was chunking. http://www.devmail.net/ 's product has a property setting to set chunking to false. The smtp class in .net does not have that capability. -greg
"Paul Henderson" <pa***********@pittville.demon.co.uk> wrote in message news:11*********************@e56g2000cwe.googlegro ups.com... >> smtpClient.Send(message) > >> I get the generic error messages; >> Troubleshooting Exceptions: System.ObjectDisposedException 'Safe >> handle >> has been closed' >> Must this be done asynchronously? Thank you. -Greg > > Apparently the SmtpClient is finalizing the underlying socket twice; > it > might mean that you are using the SmtpClient when it is not in a > suitable state, though it's difficult to see why without knowing what > your code looks like. There should be no need to do it asynchronously, > though it is neater; in this context, one would expect sending > synchronously to be more reliable as you can be sure that the > SmtpClient has finished sending the previous message; if you 'doubled > up' sending because it was asynchronous, that would cause an > exception. > It'd be helpful if you could post some code, though. >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Rune |
last post by:
Hi,
I've written a very simple 'kill-server' to help me shut down
processes through Telnet or HTTP. The kill-server is a function and is
launched as a thread. I use the module socket.py on Python...
|
by: Ajay |
last post by:
hi!
my application is throwing a bad socket error
raise error(EBADF, 'Bad file descriptor')
socket.error: (9, 'Bad file descriptor')
basically i have the following interchange
application ...
|
by: Billism |
last post by:
My email client (I programmed) recently has stopped being able to send
email with my XP machine. I have had 3 other friends test it and the same
thing happens. The program has not changed, but...
|
by: Junhua Deng (AL/EAB) |
last post by:
Hi,
I have a simple server-client application with threading. It works fine when both server and client on the same machine, but I get the following error message if the server is on another...
|
by: ticketdirector |
last post by:
Hi,
In the event viewer on our production web server (win2k3), I am seeing
that if a call to the System.Net.Mail.SmtpClient.Send() function fails
/ throws an exception, it is popping up an...
|
by: SR |
last post by:
I have 2 controls that seem to conflict with each other. On my Master page
I have a Menu control and on my Content page Panel control. The formatting
is great, all fine and dandy, until I hover...
|
by: howardr101 |
last post by:
Hi,
Have hunted around on the groups and can't find anything, hence.
I've tried this against 2 mail servers (mailtraq and hmailserver) and
it occus with both.
The problems seems to be that...
|
by: kgrafals |
last post by:
Hi,
I'm just trying to read from a webpage with urllib but I'm getting
IOErrors. This is my code:
import urllib
sock = urllib.urlopen("http://www.google.com/")
and this is the error:
|
by: clevrmnkey |
last post by:
I've had nothing but trouble from the System.Net.Mail objects, but I
finally need to make them work, and I can't for the life of me see what
I'm doing wrong.
I pared back my mail transaction to...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |