SmtpClient 2.0 Framework
-
The SmtpClient does not seem to call the QUIT Command to close the connection to an SMTP server, is this usual behaviour? It appears to keep the connection open between each mail that is sent. I would assume that at bare minimum it should call QUIT when the application that is using the SmtpClient object is shut down. Regards, J James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
Mitch Hedberg -
The SmtpClient does not seem to call the QUIT Command to close the connection to an SMTP server, is this usual behaviour? It appears to keep the connection open between each mail that is sent. I would assume that at bare minimum it should call QUIT when the application that is using the SmtpClient object is shut down. Regards, J James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
Mitch HedbergJames Simpson wrote:
I would assume
Didn't your mother tell you impolite to swear like that? :-D The
SmtpClient
class is a wrapper for the CDONTS COM Component, and its NewMail class. It is NOT a full .NET implementation of a SMTP client. It is poissible that the CDONTS class doesn't send a QUIT command. You'll have to setup a packet sniffer between your machine and the network to figure this out. I haven't been able to find any documentation on whether it actually does this or not. If you have to guarantee a QUIT command being sent, you'll have to implement your own SMTP client in your code. Just Google for "C# SMTP Client" and you'll find a bunch of examples. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome -- modified at 13:19 Wednesday 11th January, 2006 -
James Simpson wrote:
I would assume
Didn't your mother tell you impolite to swear like that? :-D The
SmtpClient
class is a wrapper for the CDONTS COM Component, and its NewMail class. It is NOT a full .NET implementation of a SMTP client. It is poissible that the CDONTS class doesn't send a QUIT command. You'll have to setup a packet sniffer between your machine and the network to figure this out. I haven't been able to find any documentation on whether it actually does this or not. If you have to guarantee a QUIT command being sent, you'll have to implement your own SMTP client in your code. Just Google for "C# SMTP Client" and you'll find a bunch of examples. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome -- modified at 13:19 Wednesday 11th January, 2006Dave Kreskowiak wrote:
The SmtpClient class is a wrapper for the CDONTS COM Component, and its NewMail class. It is NOT a full .NET implementation of a SMTP client.
I think you are refering to the 1.0/1.1 version of the Web.Mail classes, the new one (2.0) appears to be a ground up implementation of an Smtp Client which would work standalone
Dave Kreskowiak wrote:
If you have to guarantee a QUIT command being sent, you'll have to implement your own SMTP client in your code. Just Google for "C# SMTP Client" and you'll find a bunch of examples.
Its not that I need the QUIT Command sending, it is workable. If you created a forms app with a button to send a simple mail through the local SMTP server (lets assume IIS), run the application, click the button to send the mail, then restart the IIS SMTP Service, and click send again the application will fall over because the connection was closed, even though the connection has been reopened. We have an inhouse smtp service which causes exactly the same problem because it has a timeout on it, if this is normal behaviour then someone using the SmtpClient would need to wrap it in a Try Catch to resend under these conditions. I would have hoped that the SmtpClient would clean itself up and attempt to reconnect to the server itself. Or send a QUIT message after the message has been sent to the server. Thanks, James James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
Mitch Hedberg -
Dave Kreskowiak wrote:
The SmtpClient class is a wrapper for the CDONTS COM Component, and its NewMail class. It is NOT a full .NET implementation of a SMTP client.
I think you are refering to the 1.0/1.1 version of the Web.Mail classes, the new one (2.0) appears to be a ground up implementation of an Smtp Client which would work standalone
Dave Kreskowiak wrote:
If you have to guarantee a QUIT command being sent, you'll have to implement your own SMTP client in your code. Just Google for "C# SMTP Client" and you'll find a bunch of examples.
Its not that I need the QUIT Command sending, it is workable. If you created a forms app with a button to send a simple mail through the local SMTP server (lets assume IIS), run the application, click the button to send the mail, then restart the IIS SMTP Service, and click send again the application will fall over because the connection was closed, even though the connection has been reopened. We have an inhouse smtp service which causes exactly the same problem because it has a timeout on it, if this is normal behaviour then someone using the SmtpClient would need to wrap it in a Try Catch to resend under these conditions. I would have hoped that the SmtpClient would clean itself up and attempt to reconnect to the server itself. Or send a QUIT message after the message has been sent to the server. Thanks, James James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
Mitch HedbergNope. 2.0 wraps up the same CDONTS object. It just uses more code to do it. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome